summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorlum <lum@cvs.openbsd.org>2012-08-30 21:36:49 +0000
committerlum <lum@cvs.openbsd.org>2012-08-30 21:36:49 +0000
commita1ba67441d331d770cf5401df582e7c294c53539 (patch)
tree729478e75e33f501c7eb4a444086080c64c22600 /usr.bin/mg
parentf3345e1919c23eb94f6bdef92f1745f2743438e7 (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')
-rw-r--r--usr.bin/mg/file.c3
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') ? "" : "/");