summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Koenig <jk@jk.fr.eu.org>2010-08-13 19:05:14 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2010-08-18 01:29:39 +0200
commit5af547e7fc9ddc0b472b99c6bdb7341f6204e43f (patch)
treec65c7826a1f1e1fe534c1149860141e10a44369e
parent5d011324a721d7cf3babfe6aa068e247c7f27f42 (diff)
Set an appropriate st_mode on symlinks.
* procfs_pid_files.c (update_pid_entries): When symlink_target is not NULL, set st_size to the symlink length and st_mode to S_IFLNK | 0777.
-rw-r--r--procfs_pid_files.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/procfs_pid_files.c b/procfs_pid_files.c
index d44a2a2..26a0af3 100644
--- a/procfs_pid_files.c
+++ b/procfs_pid_files.c
@@ -49,7 +49,16 @@ update_pid_entries (struct procfs_dir *dir, const char *name,
struct stat stat;
memset (&stat, 0, sizeof stat);
- stat->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
+ if (symlink_target)
+ {
+ stat.st_size = strlen (symlink_target);
+ stat.st_mode = S_IFLNK | 0777;
+ }
+ else
+ {
+ stat.st_size = 0;
+ stat.st_mode = S_IFREG | 0444;
+ }
return update_entries_list (dir, name, &stat, timestamp, symlink_target);
}