]> granicus.if.org Git - cronie/commitdiff
Add missing check for stat() return value.
authorTomas Mraz <tmraz@fedoraproject.org>
Fri, 11 Mar 2011 13:02:35 +0000 (14:02 +0100)
committerTomas Mraz <tmraz@fedoraproject.org>
Fri, 11 Mar 2011 13:02:35 +0000 (14:02 +0100)
src/misc.c

index 8ccda51d2ff50e1b2e5976e902e7bdbb473f0ed3..dbe495232e03faf9c4ea35612fb6d611abaa3bcd 100644 (file)
@@ -235,7 +235,10 @@ void set_cron_cwd(void) {
                perror(SPOOL_DIR);
                if (OK == mkdir(SPOOL_DIR, 0700)) {
                        fprintf(stderr, "%s: created\n", SPOOL_DIR);
-                       stat(SPOOL_DIR, &sb);
+                       if (stat(SPOOL_DIR, &sb) < OK) {
+                               perror("stat retry");
+                               exit(ERROR_EXIT);
+                       }
                }
                else {
                        fprintf(stderr, "%s: ", SPOOL_DIR);
@@ -250,7 +253,7 @@ void set_cron_cwd(void) {
        if (grp != NULL) {
                if (sb.st_gid != grp->gr_gid)
                        if (chown(SPOOL_DIR, -1, grp->gr_gid) == -1) {
-                               fprintf(stderr, "chdir %s failed: %s\n", SPOOL_DIR,
+                               fprintf(stderr, "chown %s failed: %s\n", SPOOL_DIR,
                                        strerror(errno));
                                exit(ERROR_EXIT);
                        }