diff options
author | lum <lum@cvs.openbsd.org> | 2012-08-30 21:36:49 +0000 |
---|---|---|
committer | lum <lum@cvs.openbsd.org> | 2012-08-30 21:36:49 +0000 |
commit | a1ba67441d331d770cf5401df582e7c294c53539 (patch) | |
tree | 729478e75e33f501c7eb4a444086080c64c22600 /usr.bin/mg/file.c | |
parent | f3345e1919c23eb94f6bdef92f1745f2743438e7 (diff) |
oops. need to reset errno. Otherwise we can't save a new file in a
directory where permissions are ok.
Diffstat (limited to 'usr.bin/mg/file.c')
-rw-r--r-- | usr.bin/mg/file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c index e936d0223d9..8c1297b586f 100644 --- a/usr.bin/mg/file.c +++ b/usr.bin/mg/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.83 2012/08/30 06:09:12 lum Exp $ */ +/* $OpenBSD: file.c,v 1.84 2012/08/30 21:36:48 lum Exp $ */ /* This file is in the public domain. */ @@ -669,6 +669,7 @@ writeout(FILE ** ffp, struct buffer *bp, char *fn) dp = dirname(fn); if (stat(fn, &statbuf) == -1 && errno == ENOENT) { + errno = 0; if (access(dp, W_OK) && errno == EACCES) { ewprintf("Directory %s%s write-protected", dp, (dp[0] == '/' && dp[1] == '\0') ? "" : "/"); |