diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/vi.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/editors/vi.c b/editors/vi.c index 461cf9889..afbddc251 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -2420,14 +2420,17 @@ static int file_insert(const char * fn, char *p | |||
2420 | file_modified++; | 2420 | file_modified++; |
2421 | close(fd); | 2421 | close(fd); |
2422 | fi0: | 2422 | fi0: |
2423 | if (ENABLE_FEATURE_VI_READONLY && update_ro_status | 2423 | #if ENABLE_FEATURE_VI_READONLY |
2424 | && ((access(fn, W_OK) < 0) || | 2424 | if (update_ro_status |
2425 | /* root will always have access() | 2425 | && ((access(fn, W_OK) < 0) || |
2426 | * so we check fileperms too */ | 2426 | /* root will always have access() |
2427 | !(statbuf.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))) | 2427 | * so we check fileperms too */ |
2428 | { | 2428 | !(statbuf.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)) |
2429 | ) | ||
2430 | ) { | ||
2429 | SET_READONLY_FILE(readonly_mode); | 2431 | SET_READONLY_FILE(readonly_mode); |
2430 | } | 2432 | } |
2433 | #endif | ||
2431 | return cnt; | 2434 | return cnt; |
2432 | } | 2435 | } |
2433 | 2436 | ||