aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/make-docfile.c
diff options
context:
space:
mode:
authorPaul Eggert2011-01-22 23:30:19 -0800
committerPaul Eggert2011-01-22 23:30:19 -0800
commit9055082ef8a2f1b9033f77f0eb2b9c756a306c01 (patch)
tree041665ff66c2bdab89f2f59976fb9ce0e2003ab0 /lib-src/make-docfile.c
parentf77fabaf6bc1296631b1a4bcdf363721e19a3ac4 (diff)
downloademacs-9055082ef8a2f1b9033f77f0eb2b9c756a306c01.tar.gz
emacs-9055082ef8a2f1b9033f77f0eb2b9c756a306c01.zip
Check return values of some library calls.
Diffstat (limited to 'lib-src/make-docfile.c')
-rw-r--r--lib-src/make-docfile.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 4260e4c08f6..b6fccfacfec 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -158,7 +158,11 @@ main (int argc, char **argv)
158 } 158 }
159 if (argc > i + 1 && !strcmp (argv[i], "-d")) 159 if (argc > i + 1 && !strcmp (argv[i], "-d"))
160 { 160 {
161 chdir (argv[i + 1]); 161 if (chdir (argv[i + 1]) != 0)
162 {
163 perror (argv[i + 1]);
164 return EXIT_FAILURE;
165 }
162 i += 2; 166 i += 2;
163 } 167 }
164 168
@@ -648,6 +652,7 @@ scan_c_file (char *filename, const char *mode)
648 652
649 if (defunflag && (commas == 1 || commas == 2)) 653 if (defunflag && (commas == 1 || commas == 2))
650 { 654 {
655 int scanned = 0;
651 do 656 do
652 c = getc (infile); 657 c = getc (infile);
653 while (c == ' ' || c == '\n' || c == '\r' || c == '\t'); 658 while (c == ' ' || c == '\n' || c == '\r' || c == '\t');
@@ -655,12 +660,14 @@ scan_c_file (char *filename, const char *mode)
655 goto eof; 660 goto eof;
656 ungetc (c, infile); 661 ungetc (c, infile);
657 if (commas == 2) /* pick up minargs */ 662 if (commas == 2) /* pick up minargs */
658 fscanf (infile, "%d", &minargs); 663 scanned = fscanf (infile, "%d", &minargs);
659 else /* pick up maxargs */ 664 else /* pick up maxargs */
660 if (c == 'M' || c == 'U') /* MANY || UNEVALLED */ 665 if (c == 'M' || c == 'U') /* MANY || UNEVALLED */
661 maxargs = -1; 666 maxargs = -1;
662 else 667 else
663 fscanf (infile, "%d", &maxargs); 668 scanned = fscanf (infile, "%d", &maxargs);
669 if (scanned < 0)
670 goto eof;
664 } 671 }
665 } 672 }
666 673