ref: 4fd18f1c27d3f1eba10c849a3c9cdb7d9dc33abc
parent: 2809ae93520d9f0444f6c6f3c51db3ef65602b4b
author: Ori Bernstein <[email protected]>
date: Tue Jan 2 19:08:48 EST 2018
Error out if getcwd fails.
--- a/6/gengas.c
+++ b/6/gengas.c
@@ -9,6 +9,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
+#include <errno.h>
#include "util.h"
#include "parse.h"
@@ -471,7 +472,8 @@
}
popstab();
- getcwd(dir, sizeof dir);
+ if (!getcwd(dir, sizeof dir))
+ die("could not get cwd: %s\n", strerror(errno));
for (i = 0; i < file->file.nfiles; i++) {
path = file->file.files[i];
fprintf(fd, ".file %zd \"%s/%s\"\n", i + 1, dir, path);