Permalink
Browse files

o Writing is not possible. Show permissions as readonly.

  • Loading branch information...
1 parent 0b0bd33 commit 369a0a7178b48883083886b98c086599a75dbf21 @hzeller committed Sep 21, 2012
Showing with 8 additions and 7 deletions.
  1. +8 −7 folve-main.cc
View
@@ -74,13 +74,14 @@ static int folve_getattr(const char *path, struct stat *stbuf) {
// If this is a currently open filename, we might be able to output a better
// estimate.
int result = folve_rt.fs->StatByFilename(path, stbuf);
- if (result == 0) return result;
-
- char path_buf[PATH_MAX];
- result = lstat(assemble_orig_path(path_buf, path), stbuf);
- if (result == -1)
- return -errno;
-
+ if (result != 0) {
+ char path_buf[PATH_MAX];
+ result = lstat(assemble_orig_path(path_buf, path), stbuf);
+ if (result == -1)
+ return -errno;
+ }
+ // Whatever write mode was there before: now things are readonly.
+ stbuf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
return 0;
}

0 comments on commit 369a0a7

Please sign in to comment.