Test the return of getcwd()
[users/jgh/exim.git] / 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 */
-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();