diff options
author | Benoît Dejean <bdejean@src.gnome.org> | 2005-01-10 12:05:13 +0000 |
---|---|---|
committer | Benoît Dejean <bdejean@src.gnome.org> | 2005-01-10 12:05:13 +0000 |
commit | 48056f7d8afc0e71adfcd01ae5ab846f3a4c59dc (patch) | |
tree | cf10bd9bf96d43a66f01c7b19d4a7019c69c99b1 | |
parent | 7ca4171652dff239b35b1959bb7a32a2d066dca8 (diff) | |
download | libgtop-48056f7d8afc0e71adfcd01ae5ab846f3a4c59dc.tar.gz |
Disabled.
* glibtop_server.h:
* procopenfiles.c: (get_socket_endpoint): Disabled.
(glibtop_get_proc_open_files_s): Secured -> g_snprintf.
-rw-r--r-- | sysdeps/linux/ChangeLog | 7 | ||||
-rw-r--r-- | sysdeps/linux/glibtop_server.h | 1 | ||||
-rw-r--r-- | sysdeps/linux/procopenfiles.c | 19 |
3 files changed, 18 insertions, 9 deletions
diff --git a/sysdeps/linux/ChangeLog b/sysdeps/linux/ChangeLog index c7dab447..84e29bf7 100644 --- a/sysdeps/linux/ChangeLog +++ b/sysdeps/linux/ChangeLog @@ -1,3 +1,10 @@ +2005-01-10 Benoît Dejean <TazForEver@dlfp.org> + + * glibtop_server.h: + * procopenfiles.c: (get_socket_endpoint): Disabled. + + (glibtop_get_proc_open_files_s): Secured -> g_snprintf. + 2004-12-23 Benoît Dejean <tazforever@dlfp.org> * fsusage.c: (_glibtop_linux_get_fsusage_read_write): diff --git a/sysdeps/linux/glibtop_server.h b/sysdeps/linux/glibtop_server.h index 38ac1d1f..df249bb5 100644 --- a/sysdeps/linux/glibtop_server.h +++ b/sysdeps/linux/glibtop_server.h @@ -44,5 +44,6 @@ #define GLIBTOP_SUID_PROC_MAP 0 #define GLIBTOP_SUID_NETLOAD 0 #define GLIBTOP_SUID_PPP 0 +#define GLIBTOP_SUID_PROC_FILE 0 #endif /* __LINUX__GLIBTOP_SERVER_H__ */ diff --git a/sysdeps/linux/procopenfiles.c b/sysdeps/linux/procopenfiles.c index 5286afdc..3cd55d5e 100644 --- a/sysdeps/linux/procopenfiles.c +++ b/sysdeps/linux/procopenfiles.c @@ -65,12 +65,13 @@ get_socket_endpoint(char *buf, int *prmtport, int s) while(fgets(l, sizeof l, f)) { unsigned int loc, locport, rmt; - int sock = -1; - sscanf(l, " %*d: %8x:%4x %8x:%4x %*d %*x:%*x %*x:%*x %*d %*d %*d %d", - &loc, &locport, &rmt, prmtport, &sock); + int sock = -42; + /* FIXME + sscanf(l, "%*d: %8x:%4x %8x:%4x %*x %*x:%*x %*x:%*x %*d %*d %*d %d", + &loc, &locport, &rmt, prmtport, &sock); */ if(sock == s) { - inet_ntop(AF_INET, &rmt, buf, INET_ADDRSTRLEN); + inet_ntop(AF_INET, &rmt, buf, GLIBTOP_OPEN_DEST_HOST_LEN); break; } } @@ -104,15 +105,15 @@ glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pi char tgt [BUFSIZ]; glibtop_open_files_entry entry = {0}; + if(direntry->d_name[0] == '.') continue; - sprintf(fn, "/proc/%d/fd/%s", pid, direntry->d_name); - rv = readlink(fn, tgt, sizeof(tgt) - 1); - - if(rv < 0) - continue; + 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'; entry.fd = atoi(direntry->d_name); |