diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-08-28 13:00:29 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-08-28 13:00:29 +0200 |
commit | cc272b06eefb87030bb85b686abdbc22b5ed1c34 (patch) | |
tree | 06024199184cfab43807a1fdcc2a240b9cf5ac99 /libbb | |
parent | d84b175cb6948eb17f847313bf912174e2f934e1 (diff) | |
download | busybox-w32-1_19_1.tar.gz busybox-w32-1_19_1.tar.bz2 busybox-w32-1_19_1.zip |
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 6a15cff2f..435e4d09f 100644 --- a/libbb/getpty.c +++ b/libbb/getpty.c | |||
@@ -19,20 +19,22 @@ int FAST_FUNC xgetpty(char *line) | |||
19 | if (p > 0) { | 19 | if (p > 0) { |
20 | grantpt(p); /* chmod+chown corresponding slave pty */ | 20 | grantpt(p); /* chmod+chown corresponding slave pty */ |
21 | unlockpt(p); /* (what does this do?) */ | 21 | unlockpt(p); /* (what does this do?) */ |
22 | #ifndef HAVE_PTSNAME_R | 22 | # ifndef HAVE_PTSNAME_R |
23 | const char *name; | 23 | { |
24 | name = ptsname(p); /* find out the name of slave pty */ | 24 | const char *name; |
25 | if (!name) { | 25 | name = ptsname(p); /* find out the name of slave pty */ |
26 | bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); | 26 | if (!name) { |
27 | bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); | ||
28 | } | ||
29 | safe_strncpy(line, name, GETPTY_BUFSIZE); | ||
27 | } | 30 | } |
28 | safe_strncpy(line, name, GETPTY_BUFSIZE); | 31 | # else |
29 | #else | ||
30 | /* find out the name of slave pty */ | 32 | /* find out the name of slave pty */ |
31 | if (ptsname_r(p, line, GETPTY_BUFSIZE-1) != 0) { | 33 | if (ptsname_r(p, line, GETPTY_BUFSIZE-1) != 0) { |
32 | bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); | 34 | bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); |
33 | } | 35 | } |
34 | line[GETPTY_BUFSIZE-1] = '\0'; | 36 | line[GETPTY_BUFSIZE-1] = '\0'; |
35 | #endif | 37 | # endif |
36 | return p; | 38 | return p; |
37 | } | 39 | } |
38 | #else | 40 | #else |
diff --git a/libbb/match_fstype.c b/libbb/match_fstype.c index 83d6e6770..c792d13b3 100644 --- a/libbb/match_fstype.c +++ b/libbb/match_fstype.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 10 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifdef HAVE_MNTENT_H | ||
14 | |||
13 | #include "libbb.h" | 15 | #include "libbb.h" |
14 | 16 | ||
15 | int FAST_FUNC match_fstype(const struct mntent *mt, const char *t_fstype) | 17 | 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) | |||
40 | 42 | ||
41 | return !match; | 43 | return !match; |
42 | } | 44 | } |
45 | |||
46 | #endif /* HAVE_MNTENT_H */ | ||
diff --git a/libbb/procps.c b/libbb/procps.c index 1dea61518..e15ddd1e5 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, | |||
284 | void BUG_comm_size(void); | 284 | void BUG_comm_size(void); |
285 | procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) | 285 | procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) |
286 | { | 286 | { |
287 | struct dirent *entry; | ||
288 | char buf[PROCPS_BUFSIZE]; | ||
289 | char filename[sizeof("/proc//cmdline") + sizeof(int)*3]; | ||
290 | char *filename_tail; | ||
291 | long tasknice; | ||
292 | unsigned pid; | ||
293 | int n; | ||
294 | struct stat sb; | ||
295 | |||
296 | if (!sp) | 287 | if (!sp) |
297 | sp = alloc_procps_scan(); | 288 | sp = alloc_procps_scan(); |
298 | 289 | ||
299 | for (;;) { | 290 | for (;;) { |
291 | struct dirent *entry; | ||
292 | char buf[PROCPS_BUFSIZE]; | ||
293 | long tasknice; | ||
294 | unsigned pid; | ||
295 | int n; | ||
296 | char filename[sizeof("/proc/%u/task/%u/cmdline") + sizeof(int)*3 * 2]; | ||
297 | char *filename_tail; | ||
298 | |||
300 | #if ENABLE_FEATURE_SHOW_THREADS | 299 | #if ENABLE_FEATURE_SHOW_THREADS |
301 | if ((flags & PSSCAN_TASKS) && sp->task_dir) { | 300 | if (sp->task_dir) { |
302 | entry = readdir(sp->task_dir); | 301 | entry = readdir(sp->task_dir); |
303 | if (entry) | 302 | if (entry) |
304 | goto got_entry; | 303 | goto got_entry; |
305 | closedir(sp->task_dir); | 304 | closedir(sp->task_dir); |
306 | sp->task_dir = NULL; | 305 | sp->task_dir = NULL; |
307 | sp->main_thread_pid = 0; | ||
308 | } | 306 | } |
309 | #endif | 307 | #endif |
310 | entry = readdir(sp->dir); | 308 | entry = readdir(sp->dir); |
@@ -321,9 +319,9 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) | |||
321 | /* We found another /proc/PID. Do not use it, | 319 | /* We found another /proc/PID. Do not use it, |
322 | * there will be /proc/PID/task/PID (same PID!), | 320 | * there will be /proc/PID/task/PID (same PID!), |
323 | * so just go ahead and dive into /proc/PID/task. */ | 321 | * so just go ahead and dive into /proc/PID/task. */ |
324 | char task_dir[sizeof("/proc/%u/task") + sizeof(int)*3]; | 322 | sprintf(filename, "/proc/%u/task", pid); |
325 | sprintf(task_dir, "/proc/%u/task", pid); | 323 | /* Note: if opendir fails, we just go to next /proc/XXX */ |
326 | sp->task_dir = xopendir(task_dir); | 324 | sp->task_dir = opendir(filename); |
327 | sp->main_thread_pid = pid; | 325 | sp->main_thread_pid = pid; |
328 | continue; | 326 | continue; |
329 | } | 327 | } |
@@ -347,9 +345,15 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) | |||
347 | } | 345 | } |
348 | #endif | 346 | #endif |
349 | 347 | ||
350 | filename_tail = filename + sprintf(filename, "/proc/%u/", pid); | 348 | #if ENABLE_FEATURE_SHOW_THREADS |
349 | if (sp->task_dir) | ||
350 | filename_tail = filename + sprintf(filename, "/proc/%u/task/%u/", sp->main_thread_pid, pid); | ||
351 | else | ||
352 | #endif | ||
353 | filename_tail = filename + sprintf(filename, "/proc/%u/", pid); | ||
351 | 354 | ||
352 | if (flags & PSSCAN_UIDGID) { | 355 | if (flags & PSSCAN_UIDGID) { |
356 | struct stat sb; | ||
353 | if (stat(filename, &sb)) | 357 | if (stat(filename, &sb)) |
354 | continue; /* process probably exited */ | 358 | continue; /* process probably exited */ |
355 | /* Effective UID/GID, not real */ | 359 | /* Effective UID/GID, not real */ |
diff --git a/libbb/udp_io.c b/libbb/udp_io.c index b8fb6755d..7985a9723 100644 --- a/libbb/udp_io.c +++ b/libbb/udp_io.c | |||
@@ -13,7 +13,7 @@ | |||
13 | * We don't check for errors here. Not supported == won't be used | 13 | * We don't check for errors here. Not supported == won't be used |
14 | */ | 14 | */ |
15 | void FAST_FUNC | 15 | void FAST_FUNC |
16 | socket_want_pktinfo(int fd) | 16 | socket_want_pktinfo(int fd UNUSED_PARAM) |
17 | { | 17 | { |
18 | #ifdef IP_PKTINFO | 18 | #ifdef IP_PKTINFO |
19 | setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &const_int_1, sizeof(int)); | 19 | setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &const_int_1, sizeof(int)); |