summaryrefslogtreecommitdiff
path: root/editors/vi.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-08-17 08:29:48 +0000
committerDenis Vlasenko2007-08-17 08:29:48 +0000
commit856be770a66a4d928f13c9d2f401dc1092e5270e (patch)
tree62c6391260ae26ec9a383e72265a4ab3f6894373 /editors/vi.c
parent7f175ccbc38c0de2423a9554f8ee1663431845d9 (diff)
downloadbusybox-856be770a66a4d928f13c9d2f401dc1092e5270e.zip
busybox-856be770a66a4d928f13c9d2f401dc1092e5270e.tar.gz
assorted fixes for breakage found by randomconfig
Diffstat (limited to 'editors/vi.c')
-rw-r--r--editors/vi.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 461cf98..afbddc2 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2420,14 +2420,17 @@ static int file_insert(const char * fn, char *p
file_modified++;
close(fd);
fi0:
- if (ENABLE_FEATURE_VI_READONLY && update_ro_status
- && ((access(fn, W_OK) < 0) ||
- /* root will always have access()
- * so we check fileperms too */
- !(statbuf.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH))))
- {
+#if ENABLE_FEATURE_VI_READONLY
+ if (update_ro_status
+ && ((access(fn, W_OK) < 0) ||
+ /* root will always have access()
+ * so we check fileperms too */
+ !(statbuf.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH))
+ )
+ ) {
SET_READONLY_FILE(readonly_mode);
}
+#endif
return cnt;
}