76a39a
diff -up at-3.1.18/atd.c.noabort at-3.1.18/atd.c
76a39a
--- at-3.1.18/atd.c.noabort	2016-03-23 12:49:15.147520116 +0100
76a39a
+++ at-3.1.18/atd.c	2016-03-23 12:49:15.148520138 +0100
76a39a
@@ -349,9 +349,12 @@ run_file(const char *filename, uid_t uid
76a39a
      */
76a39a
 
76a39a
     pid = fork();
76a39a
-    if (pid == -1)
76a39a
-	perr("Cannot fork");
76a39a
-
76a39a
+    if (pid == -1) {
76a39a
+	lerr("Cannot fork for job execution");
76a39a
+	free(mailname);
76a39a
+	free(newname);
76a39a
+	return;
76a39a
+    }
76a39a
     else if (pid != 0) {
76a39a
 	free(mailname);
76a39a
 	free(newname);
76a39a
@@ -669,15 +672,19 @@ run_loop()
76a39a
      * up.
76a39a
      */
76a39a
 
76a39a
-    if (stat(".", &buf) == -1)
76a39a
-	perr("Cannot stat " ATJOB_DIR);
76a39a
+    if (stat(".", &buf) == -1) {
76a39a
+	lerr("Cannot stat " ATJOB_DIR);
76a39a
+        return next_job;
76a39a
+    }
76a39a
 
76a39a
     if (nothing_to_do && buf.st_mtime <= last_chg)
76a39a
 	return next_job;
76a39a
     last_chg = buf.st_mtime;
76a39a
 
76a39a
-    if ((spool = opendir(".")) == NULL)
76a39a
-	perr("Cannot read " ATJOB_DIR);
76a39a
+    if ((spool = opendir(".")) == NULL) {
76a39a
+	lerr("Cannot read " ATJOB_DIR);
76a39a
+        return next_job;
76a39a
+    }
76a39a
 
76a39a
     run_batch = 0;
76a39a
     nothing_to_do = 1;