summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-01-03 00:08:48 -0800
committerOri Bernstein <ori@eigenstate.org>2018-01-11 22:16:11 -0800
commit4fd18f1c27d3f1eba10c849a3c9cdb7d9dc33abc (patch)
tree59efd555411c51ee16e6e4466d914c3d29651a68 /6
parent2809ae93520d9f0444f6c6f3c51db3ef65602b4b (diff)
downloadmc-4fd18f1c27d3f1eba10c849a3c9cdb7d9dc33abc.tar.gz
Error out if getcwd fails.
Diffstat (limited to '6')
-rw-r--r--6/gengas.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/6/gengas.c b/6/gengas.c
index 6437c82..805bada 100644
--- 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 @@ gengas(Node *file, FILE *fd)
}
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);