diff options
author | Ron Yorston <rmy@pobox.com> | 2012-03-22 16:14:13 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-03-22 16:14:13 +0000 |
commit | 800c3f176fb21e30fbaa81ef68f50e601ea2f78b (patch) | |
tree | 84f4a2bf30d3208a020b25c82c11ac636c7072c6 /libbb | |
parent | 9db164d6e39050d09f38288c6045cd2a2cbf6d63 (diff) | |
parent | f99811908419608e3ab81393d0177cc456101e4b (diff) | |
download | busybox-w32-800c3f176fb21e30fbaa81ef68f50e601ea2f78b.tar.gz busybox-w32-800c3f176fb21e30fbaa81ef68f50e601ea2f78b.tar.bz2 busybox-w32-800c3f176fb21e30fbaa81ef68f50e601ea2f78b.zip |
Merge commit '1_19_4' into merge_1_19
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/getpty.c | 18 | ||||
-rw-r--r-- | libbb/lineedit.c | 2 | ||||
-rw-r--r-- | libbb/match_fstype.c | 4 | ||||
-rw-r--r-- | libbb/procps.c | 34 | ||||
-rw-r--r-- | libbb/udp_io.c | 2 |
5 files changed, 35 insertions, 25 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/lineedit.c b/libbb/lineedit.c index 1b97e8609..46ae93f8a 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1433,7 +1433,7 @@ static void save_history(char *str) | |||
1433 | 1433 | ||
1434 | /* write out temp file and replace hist_file atomically */ | 1434 | /* write out temp file and replace hist_file atomically */ |
1435 | new_name = xasprintf("%s.%u.new", state->hist_file, (int) getpid()); | 1435 | new_name = xasprintf("%s.%u.new", state->hist_file, (int) getpid()); |
1436 | fd = open(state->hist_file, O_WRONLY | O_CREAT | O_TRUNC, 0600); | 1436 | fd = open(new_name, O_WRONLY | O_CREAT | O_TRUNC, 0600); |
1437 | if (fd >= 0) { | 1437 | if (fd >= 0) { |
1438 | FILE *fp; | 1438 | FILE *fp; |
1439 | int i; | 1439 | int i; |
diff --git a/libbb/match_fstype.c b/libbb/match_fstype.c index 83d6e6770..32c3d7f18 100644 --- a/libbb/match_fstype.c +++ b/libbb/match_fstype.c | |||
@@ -12,6 +12,8 @@ | |||
12 | 12 | ||
13 | #include "libbb.h" | 13 | #include "libbb.h" |
14 | 14 | ||
15 | #ifdef HAVE_MNTENT_H | ||
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) |
16 | { | 18 | { |
17 | int match = 1; | 19 | int match = 1; |
@@ -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 b5582edfa..39ddd2c12 100644 --- a/libbb/procps.c +++ b/libbb/procps.c | |||
@@ -285,27 +285,25 @@ int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, | |||
285 | void BUG_comm_size(void); | 285 | void BUG_comm_size(void); |
286 | procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) | 286 | procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) |
287 | { | 287 | { |
288 | struct dirent *entry; | ||
289 | char buf[PROCPS_BUFSIZE]; | ||
290 | char filename[sizeof("/proc//cmdline") + sizeof(int)*3]; | ||
291 | char *filename_tail; | ||
292 | long tasknice; | ||
293 | unsigned pid; | ||
294 | int n; | ||
295 | struct stat sb; | ||
296 | |||
297 | if (!sp) | 288 | if (!sp) |
298 | sp = alloc_procps_scan(); | 289 | sp = alloc_procps_scan(); |
299 | 290 | ||
300 | for (;;) { | 291 | for (;;) { |
292 | struct dirent *entry; | ||
293 | char buf[PROCPS_BUFSIZE]; | ||
294 | long tasknice; | ||
295 | unsigned pid; | ||
296 | int n; | ||
297 | char filename[sizeof("/proc/%u/task/%u/cmdline") + sizeof(int)*3 * 2]; | ||
298 | char *filename_tail; | ||
299 | |||
301 | #if ENABLE_FEATURE_SHOW_THREADS | 300 | #if ENABLE_FEATURE_SHOW_THREADS |
302 | if ((flags & PSSCAN_TASKS) && sp->task_dir) { | 301 | if (sp->task_dir) { |
303 | entry = readdir(sp->task_dir); | 302 | entry = readdir(sp->task_dir); |
304 | if (entry) | 303 | if (entry) |
305 | goto got_entry; | 304 | goto got_entry; |
306 | closedir(sp->task_dir); | 305 | closedir(sp->task_dir); |
307 | sp->task_dir = NULL; | 306 | sp->task_dir = NULL; |
308 | sp->main_thread_pid = 0; | ||
309 | } | 307 | } |
310 | #endif | 308 | #endif |
311 | entry = readdir(sp->dir); | 309 | entry = readdir(sp->dir); |
@@ -322,9 +320,9 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) | |||
322 | /* We found another /proc/PID. Do not use it, | 320 | /* We found another /proc/PID. Do not use it, |
323 | * there will be /proc/PID/task/PID (same PID!), | 321 | * there will be /proc/PID/task/PID (same PID!), |
324 | * so just go ahead and dive into /proc/PID/task. */ | 322 | * so just go ahead and dive into /proc/PID/task. */ |
325 | char task_dir[sizeof("/proc/%u/task") + sizeof(int)*3]; | 323 | sprintf(filename, "/proc/%u/task", pid); |
326 | sprintf(task_dir, "/proc/%u/task", pid); | 324 | /* Note: if opendir fails, we just go to next /proc/XXX */ |
327 | sp->task_dir = xopendir(task_dir); | 325 | sp->task_dir = opendir(filename); |
328 | sp->main_thread_pid = pid; | 326 | sp->main_thread_pid = pid; |
329 | continue; | 327 | continue; |
330 | } | 328 | } |
@@ -348,9 +346,15 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) | |||
348 | } | 346 | } |
349 | #endif | 347 | #endif |
350 | 348 | ||
351 | filename_tail = filename + sprintf(filename, "/proc/%u/", pid); | 349 | #if ENABLE_FEATURE_SHOW_THREADS |
350 | if (sp->task_dir) | ||
351 | filename_tail = filename + sprintf(filename, "/proc/%u/task/%u/", sp->main_thread_pid, pid); | ||
352 | else | ||
353 | #endif | ||
354 | filename_tail = filename + sprintf(filename, "/proc/%u/", pid); | ||
352 | 355 | ||
353 | if (flags & PSSCAN_UIDGID) { | 356 | if (flags & PSSCAN_UIDGID) { |
357 | struct stat sb; | ||
354 | if (stat(filename, &sb)) | 358 | if (stat(filename, &sb)) |
355 | continue; /* process probably exited */ | 359 | continue; /* process probably exited */ |
356 | /* Effective UID/GID, not real */ | 360 | /* 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)); |