Test the return of getcwd()
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Wed, 9 Mar 2016 10:51:31 +0000 (11:51 +0100)
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Wed, 9 Mar 2016 10:51:31 +0000 (11:51 +0100)
src/src/exim.c

index 574e7804ba37adb9564bd99f1e045d82c3716410..3b6a9ba69ec4628d1a25be78e9f6baf2e027c85a 100644 (file)
@@ -3748,7 +3748,11 @@ directory to "/"! Later we change to $spool_directory. We do it there, because
 during readconf_main() some expansion takes place already. */
 
 /* Store the initial cwd before we change directories */
 during readconf_main() some expansion takes place already. */
 
 /* Store the initial cwd before we change directories */
-initial_cwd = getcwd(NULL, 0);
+if ((initial_cwd = getcwd(NULL, 0)) == NULL)
+  {
+  perror("exim: can't get the current working directory");
+  exit(EXIT_FAILURE);
+  }
 
 readconf_main();
 
 
 readconf_main();