* fhandler_proc.cc (fhandler_proc::fstat): Prime with information from

fhandler_base::fstat.  Use defines rather than constants for permission
settings.
This commit is contained in:
Christopher Faylor 2002-05-02 23:58:20 +00:00
parent d055ecb08f
commit 3bb7eb449c
2 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2002-05-02 Christopher Faylor <cgf@redhat.com>
* fhandler_proc.cc (fhandler_proc::fstat): Prime with information from
fhandler_base::fstat. Use defines rather than constants for permission
settings.
2002-04-30 Eric Blake <ebb9@email.byu.edu> 2002-04-30 Eric Blake <ebb9@email.byu.edu>
* path.cc (hash_path_name): Improve hash function strength. * path.cc (hash_path_name): Improve hash function strength.

View File

@ -78,26 +78,27 @@ fhandler_process::fhandler_process ():
} }
int int
fhandler_process::fstat (struct __stat64 *buf, path_conv *path) fhandler_process::fstat (struct __stat64 *buf, path_conv *pc)
{ {
int file_type = exists ((const char *) get_name ()); int file_type = exists ((const char *) get_name ());
(void) fhandler_base::fstat (buf, pc);
buf->st_mode &= ~_IFMT & NO_W;
switch (file_type) switch (file_type)
{ {
case 0: case 0:
set_errno (ENOENT); set_errno (ENOENT);
return -1; return -1;
case 1: case 1:
buf->st_mode = S_IFDIR | 0555; buf->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
buf->st_nlink = 1;
return 0; return 0;
case 2: case 2:
buf->st_mode = S_IFDIR | 0555; buf->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
buf->st_nlink = PROCESS_LINK_COUNT; buf->st_nlink = PROCESS_LINK_COUNT;
return 0; return 0;
default: default:
case -1: case -1:
buf->st_mode = S_IFREG | 0444; buf->st_mode |= S_IFREG;
buf->st_nlink = 1;
return 0; return 0;
} }
} }