Manual commit from my local git-svn which is broken :/
svn path=/trunk/; revision=2578
This commit is contained in:
@@ -1,3 +1,29 @@
|
||||
2007-05-07 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* procwd.c:
|
||||
|
||||
Always set buf->number.
|
||||
|
||||
2007-05-07 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* glibtop_private.c (safe_readlink):
|
||||
|
||||
Simplified.
|
||||
|
||||
* procopenfiles.c:
|
||||
|
||||
Use safe_readlink.
|
||||
|
||||
2007-05-07 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* procwd.c:
|
||||
|
||||
Implemented.
|
||||
|
||||
* glibtop_private.c (safe_readlink):
|
||||
|
||||
New function.
|
||||
|
||||
2007-03-13 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* fsusage.c: (get_sys_path), (linux_2_6_0):
|
||||
|
@@ -8,7 +8,7 @@ libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procargs.c procmap.c siglist.c \
|
||||
sysinfo.c netload.c ppp.c glibtop_private.c \
|
||||
fsusage.c netlist.c procopenfiles.c
|
||||
fsusage.c netlist.c procopenfiles.c procwd.c
|
||||
|
||||
libgtop_sysdeps_2_0_la_LIBADD = @GLIB_LIBS@
|
||||
|
||||
|
@@ -184,3 +184,20 @@ has_sysfs(void)
|
||||
|
||||
return sysfs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
gboolean safe_readlink(const char *path, char *buf, size_t bufsiz)
|
||||
{
|
||||
ssize_t ret;
|
||||
|
||||
ret = readlink(path, buf, bufsiz - 1);
|
||||
|
||||
if (ret == -1) {
|
||||
g_warning("Could not read link %s : %s", path, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
buf[ret] = '\0';
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -145,6 +145,8 @@ check_cpu_line_warn(glibtop *server, const char *line, unsigned i)
|
||||
gboolean
|
||||
has_sysfs(void) G_GNUC_INTERNAL G_GNUC_CONST;
|
||||
|
||||
gboolean safe_readlink(const char *path, char *buf, size_t bufsiz);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#define GLIBTOP_SUID_PROC_MAP 0
|
||||
#define GLIBTOP_SUID_NETLOAD 0
|
||||
#define GLIBTOP_SUID_NETLIST 0
|
||||
#define GLIBTOP_SUID_PROC_WD 0
|
||||
#define GLIBTOP_SUID_PPP 0
|
||||
#define GLIBTOP_SUID_PROC_FILE 0
|
||||
|
||||
|
@@ -204,9 +204,8 @@ glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pi
|
||||
g_snprintf(fn, sizeof fn, "/proc/%d/fd/%s",
|
||||
pid, direntry->d_name);
|
||||
|
||||
rv = readlink(fn, tgt, sizeof(tgt) - 1);
|
||||
if(rv < 0) continue;
|
||||
tgt[rv] = '\0';
|
||||
if (!safe_readlink(fn, tgt, tgt))
|
||||
continue;
|
||||
|
||||
entry.fd = atoi(direntry->d_name);
|
||||
|
||||
|
Reference in New Issue
Block a user