aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main.c b/main.c
index c5c11080..0ba574c9 100644
--- a/main.c
+++ b/main.c
@@ -552,10 +552,10 @@ main(int argc, char *const *argv)
char *_cwd = NULL;
if (cwd == NULL) {
- errno = 0;
size_t buf_len = 1024;
do {
_cwd = xrealloc(_cwd, buf_len);
+ errno = 0;
if (getcwd(_cwd, buf_len) == NULL && errno != ERANGE) {
LOG_ERRNO("failed to get current working directory");
goto out;