diff options
author | Denys Vlasenko | 2011-08-28 13:00:29 +0200 |
---|---|---|
committer | Denys Vlasenko | 2011-08-28 13:00:29 +0200 |
commit | cc272b06eefb87030bb85b686abdbc22b5ed1c34 (patch) | |
tree | 06024199184cfab43807a1fdcc2a240b9cf5ac99 /libbb | |
parent | d84b175cb6948eb17f847313bf912174e2f934e1 (diff) | |
download | busybox-cc272b06eefb87030bb85b686abdbc22b5ed1c34.zip busybox-cc272b06eefb87030bb85b686abdbc22b5ed1c34.tar.gz |
Apply post-1.19.0 patches, bump version to 1.19.11_19_1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/getpty.c | 18 | ||||
-rw-r--r-- | libbb/match_fstype.c | 4 | ||||
-rw-r--r-- | libbb/procps.c | 34 | ||||
-rw-r--r-- | libbb/udp_io.c | 2 |
4 files changed, 34 insertions, 24 deletions
diff --git a/libbb/getpty.c b/libbb/getpty.c index 6a15cff..435e4d0 100644 --- a/libbb/getpty.c +++ b/libbb/getpty.c @@ -19,20 +19,22 @@ int FAST_FUNC xgetpty(char *line) if (p > 0) { grantpt(p); /* chmod+chown corresponding slave pty */ unlockpt(p); /* (what does this do?) */ -#ifndef HAVE_PTSNAME_R - const char *name; - name = ptsname(p); /* find out the name of slave pty */ - if (!name) { - bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); +# ifndef HAVE_PTSNAME_R + { + const char *name; + name = ptsname(p); /* find out the name of slave pty */ + if (!name) { + bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); + } + safe_strncpy(line, name, GETPTY_BUFSIZE); } - safe_strncpy(line, name, GETPTY_BUFSIZE); -#else +# else /* find out the name of slave pty */ if (ptsname_r(p, line, GETPTY_BUFSIZE-1) != 0) { bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); } line[GETPTY_BUFSIZE-1] = '\0'; -#endif +# endif return p; } #else diff --git a/libbb/match_fstype.c b/libbb/match_fstype.c index 83d6e67..c792d13 100644 --- a/libbb/match_fstype.c +++ b/libbb/match_fstype.c @@ -10,6 +10,8 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +#ifdef HAVE_MNTENT_H + #include "libbb.h" int FAST_FUNC match_fstype(const struct mntent *mt, const char *t_fstype) @@ -40,3 +42,5 @@ int FAST_FUNC match_fstype(const struct mntent *mt, const char *t_fstype) return !match; } + +#endif /* HAVE_MNTENT_H */ diff --git a/libbb/procps.c b/libbb/procps.c index 1dea615..e15ddd1 100644 --- a/libbb/procps.c +++ b/libbb/procps.c @@ -284,27 +284,25 @@ int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, void BUG_comm_size(void); procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) { - struct dirent *entry; - char buf[PROCPS_BUFSIZE]; - char filename[sizeof("/proc//cmdline") + sizeof(int)*3]; - char *filename_tail; - long tasknice; - unsigned pid; - int n; - struct stat sb; - if (!sp) sp = alloc_procps_scan(); for (;;) { + struct dirent *entry; + char buf[PROCPS_BUFSIZE]; + long tasknice; + unsigned pid; + int n; + char filename[sizeof("/proc/%u/task/%u/cmdline") + sizeof(int)*3 * 2]; + char *filename_tail; + #if ENABLE_FEATURE_SHOW_THREADS - if ((flags & PSSCAN_TASKS) && sp->task_dir) { + if (sp->task_dir) { entry = readdir(sp->task_dir); if (entry) goto got_entry; closedir(sp->task_dir); sp->task_dir = NULL; - sp->main_thread_pid = 0; } #endif entry = readdir(sp->dir); @@ -321,9 +319,9 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) /* We found another /proc/PID. Do not use it, * there will be /proc/PID/task/PID (same PID!), * so just go ahead and dive into /proc/PID/task. */ - char task_dir[sizeof("/proc/%u/task") + sizeof(int)*3]; - sprintf(task_dir, "/proc/%u/task", pid); - sp->task_dir = xopendir(task_dir); + sprintf(filename, "/proc/%u/task", pid); + /* Note: if opendir fails, we just go to next /proc/XXX */ + sp->task_dir = opendir(filename); sp->main_thread_pid = pid; continue; } @@ -347,9 +345,15 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) } #endif - filename_tail = filename + sprintf(filename, "/proc/%u/", pid); +#if ENABLE_FEATURE_SHOW_THREADS + if (sp->task_dir) + filename_tail = filename + sprintf(filename, "/proc/%u/task/%u/", sp->main_thread_pid, pid); + else +#endif + filename_tail = filename + sprintf(filename, "/proc/%u/", pid); if (flags & PSSCAN_UIDGID) { + struct stat sb; if (stat(filename, &sb)) continue; /* process probably exited */ /* Effective UID/GID, not real */ diff --git a/libbb/udp_io.c b/libbb/udp_io.c index b8fb675..7985a97 100644 --- a/libbb/udp_io.c +++ b/libbb/udp_io.c @@ -13,7 +13,7 @@ * We don't check for errors here. Not supported == won't be used */ void FAST_FUNC -socket_want_pktinfo(int fd) +socket_want_pktinfo(int fd UNUSED_PARAM) { #ifdef IP_PKTINFO setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &const_int_1, sizeof(int)); |