Dr. Werner Fink 2012-02-27 17:46:23 +00:00 committed by Git OBS Bridge
parent c4bff864d9
commit 881a7e1f57
8 changed files with 62 additions and 557 deletions

View File

@ -1,489 +0,0 @@
diff --git a/ChangeLog b/ChangeLog
index f10cea1..e5c36fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
+Changes in 22.15
+================
+ * Really apply patch for SF#31110178 RH#651794
+ * Conditionally use fork before stat calls
+ * Patch from Corrina Vinschen for compiling on cygwin
+ * Remove doubled content in src/lists.h
+ * Add another 2 for thread brackets in pstree.c
+
Changes in 22.14
================
- * Fix file descriptor as weel as memory leaks in fuser
+ * Fix file descriptor as well as memory leaks in fuser
* Strip @ symbol from file names read from /proc/net/unix
* Above 2 changes close openSuSE bugs #536209, #529520, and #417841
and provided by Werner Fink
diff --git a/README b/README
index 2489b05..2bc973f 100644
--- a/README
+++ b/README
@@ -17,6 +17,13 @@ They should work with most recent kernels. Man pages are included.
src/loop.h was stolen from util-linux package which in turn stole it from
the Linux kernel.
+fuser on network fs
+-------------------
+On network filesystems, fuser can hang because its trying to stat files
+that may go away. If you use the --with-timeout-stat option during
+the configure step then fuser will fork a process to run stat. This means
+fuser doesn't hang, but it is much slower.
+
Translations
------------
My thanks for the various translators who have cheerfully given me the po
diff --git a/configure.ac b/configure.ac
index d9013d5..6177975 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,16 @@ if test "$enable_selinux" = "yes"; then
fi
AC_SUBST([SELINUX_LIB])
+dnl Call fork before all stat calls to stop hanging on NFS mounts
+AC_SUBST([WITH_TIMEOUT_STAT])
+AC_ARG_ENABLE([TIMEOUT_STAT],
+ [AS_HELP_STRING([--enable-timeout-stat], [Use a timeout on stat calls])],
+ [enable_timeout_stat=$enableval],
+ [enable_timeout_stat="no"])
+if test "$enable_timeout_stat" = "yes"; then
+ AC_DEFINE([WITH_timeout_stat], [1], [Use timeout on stat calls])
+fi
+
dnl ipv4 only option
AC_SUBST([WITH_IPV6])
AC_ARG_ENABLE([ipv6],
@@ -112,7 +122,7 @@ AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_STAT
-AC_CHECK_FUNCS([atexit getmntent memset nl_langinfo regcomp rpmatch setlocale socket strcasecmp strchr strdup strerror strpbrk strrchr strtoul])
+AC_CHECK_FUNCS([atexit getmntent memset nl_langinfo rawmemchr regcomp rpmatch setlocale socket strcasecmp strchr strdup strerror strpbrk strrchr strtoul])
dnl Checks for Large File System
AC_SYS_LARGEFILE
diff --git a/src/Makefile.am b/src/Makefile.am
index 7cff9fd..4398631 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,21 +23,24 @@ if WANT_PEEKFD_MIPS
AM_CFLAGS += -DMIPS
endif
-
fuser_SOURCES = fuser.c comm.h signals.c signals.h i18n.h fuser.h lists.h
+fuser_LDADD = @LIBINTL@
+
killall_SOURCES = killall.c comm.h signals.c signals.h i18n.h
-killall_LDADD = @SELINUX_LIB@
+killall_LDADD = @LIBINTL@ @SELINUX_LIB@
peekfd_SOURCES = peekfd.c
pstree_SOURCES = pstree.c comm.h i18n.h
-pstree_LDADD = @TERMCAP_LIB@ @SELINUX_LIB@
+pstree_LDADD = @LIBINTL@ @TERMCAP_LIB@ @SELINUX_LIB@
prtstat_SOURCES = prtstat.c prtstat.h
+prtstat_LDADD = @LIBINTL@
+
BUILT_SOURCES = signames.h
EXTRA_DIST = signames.c
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
@@ -169,6 +169,7 @@ USE_NLS = @USE_NLS@
VERSION = @VERSION@
WITH_IPV6 = @WITH_IPV6@
WITH_SELINUX = @WITH_SELINUX@
+WITH_TIMEOUT_STAT = @WITH_TIMEOUT_STAT@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
abs_builddir = @abs_builddir@
diff --git a/src/fuser.c b/src/fuser.c
index 5f27179..476fdf1 100644
--- a/src/fuser.c
+++ b/src/fuser.c
@@ -48,6 +48,12 @@
#include <signal.h>
#include <getopt.h>
#include <setjmp.h>
+#include <limits.h>
+/* MAXSYMLINKS is a BSDism. If it doesn't exist, fall back to SYMLINK_MAX,
+ which is the POSIX name. */
+#ifndef MAXSYMLINKS
+#define MAXSYMLINKS SYMLINK_MAX
+#endif
#include "fuser.h"
#include "signals.h"
@@ -106,7 +112,11 @@ static dev_t device(const char *path);
static char *expandpath(const char *path);
typedef int (*stat_t)(const char*, struct stat*);
+#ifdef WITH_TIMEOUT_STAT
static int timeout(stat_t func, const char *path, struct stat *buf, unsigned int seconds);
+#else
+#define timeout(func,path,buf,dummy) (func)((path),(buf))
+#endif /* WITH_TIMEOUT_STAT */
static void usage(const char *errormsg)
{
@@ -1160,8 +1170,13 @@ print_matches(struct names *names_head, const opt_type opts,
for (nptr = names_head; nptr != NULL; nptr = nptr->next) {
if (opts & OPT_SILENT) {
- if (nptr->matched_procs != NULL)
- have_match = 1;
+ for (pptr = nptr->matched_procs; pptr != NULL;
+ pptr = pptr->next) {
+ if(pptr->proc_type != PTYPE_NORMAL)
+ continue;
+
+ have_match = 1;
+ }
} else { /* We're not silent */
if ((opts & OPT_ALLFILES) == 0) {
name_has_procs = 0;
@@ -1222,7 +1237,7 @@ print_matches(struct names *names_head, const opt_type opts,
pwent->pw_name);
}
if (pptr->proc_type == PTYPE_NORMAL)
- printf("%6d", pptr->pid);
+ printf(" %5d", pptr->pid);
else
printf("kernel");
fflush(stdout);
@@ -1316,12 +1331,11 @@ static struct stat *get_pidstat(const pid_t pid, const char *filename)
if ((st = (struct stat*)malloc(sizeof(struct stat))) == NULL)
return NULL;
snprintf(pathname, 256, "/proc/%d/%s", pid, filename);
- if (timeout(stat, pathname, st, 5) != 0)
- goto out;
+ if (timeout(stat, pathname, st, 5) != 0) {
+ free(st);
+ return NULL;
+ }
return st;
-out:
- free(st);
- return NULL;
}
static void
@@ -1778,6 +1792,7 @@ sigalarm(int sig)
siglongjmp(jenv, 1);
}
+#ifdef HAVE_TIMEOUT_STAT
static int
timeout(stat_t func, const char *path, struct stat *buf, unsigned int seconds)
{
@@ -1826,6 +1841,7 @@ timeout(stat_t func, const char *path, struct stat *buf, unsigned int seconds)
err:
return -1;
}
+#endif /* HAVE_TIMEOUT_STAT */
#ifdef _LISTS_H
/*
@@ -1967,7 +1983,11 @@ char* expandpath(const char * path)
if (*path != '/') {
if (!getcwd(curr, PATH_MAX))
return (char*)0;
+#ifdef HAVE_RAWMEMCHR
dest = rawmemchr(curr, '\0');
+#else
+ dest = strchr(curr, '\0');
+#endif
} else {
*curr = '/';
dest = curr + 1;
diff --git a/src/lists.h b/src/lists.h
index d91bbdf..5081e25 100644
--- a/src/lists.h
+++ b/src/lists.h
@@ -68,256 +68,7 @@ extern inline void attribute((used,__gnu_inline__,always_inline,__artificial__))
asm volatile ("lfetch [%0]" :: "r" (x))
#elif defined(__powerpc64__)
asm volatile ("dcbt 0,%0" :: "r" (x))
-#elif 1 && defined(__i386__)
- asm volatile ("661:\n\t"
- ".byte 0x8d,0x74,0x26,0x00\n"
- "\n662:\n"
- ".section .altinstructions,\"a\"\n"
- " .align 4\n"
- " .long 661b\n"
- " .long 663f\n"
- " .byte %c0\n"
- " .byte 662b-661b\n"
- " .byte 664f-663f\n"
- ".previous\n"
- ".section .altinstr_replacement,\"ax\"\n"
- " 663:\n\t"
- " prefetchnta (%1)"
- " \n664:\n"
- ".previous"
- :: "i" ((0*32+25)), "r" (x))
-#else
- __builtin_prefetch ((x), 0, 1);
-#endif
- ;
-}
-
-#if defined(DEBUG) && (DEBUG > 0)
-# define __align attribute((packed))
-#else
-# define __align attribute((aligned(sizeof(struct list_struct*))))
-#endif
-#define __packed attribute((packed))
-
-#define alignof(type) ((sizeof(type)+(sizeof(void*)-1)) & ~(sizeof(void*)-1))
-#define strsize(string) ((strlen(string)+1)*sizeof(char))
-
-typedef struct list_struct {
- struct list_struct * next, * prev;
-} __align list_t;
-
-/*
- * Linked list handling
- * ====================
- * The structures which will be linked into such lists have to be of the
- * same type. The structures may have alway a list identifier of the type
- * `list_t' as very first element. With this the macro list_entry() can
- * be used to cast the memory address of a list member to the corresponding
- * allocated structure.
- */
-
-/*
- * Insert new entry as next member.
- */
-static inline void _insert(list_t *restrict new, list_t *restrict here) attribute((always_inline,nonnull(1,2)));
-static inline void _insert(list_t *restrict new, list_t *restrict here)
-{
- list_t * prev = here;
- list_t * next = here->next;
-
- next->prev = new;
- new->next = next;
- new->prev = prev;
- prev->next = new;
-}
-
-#define insert(new, list) _insert(&((new)->this), (&(list)));
-#define append(new, list) _insert(&((new)->this), (&(list))->prev);
-
-/*
- * Set head
- */
-static inline void initial(list_t *restrict head) attribute((always_inline,nonnull(1)));
-static inline void initial(list_t *restrict head)
-{
- head->prev = head->next = head;
-}
-
-/*
- * Remove entries, note that the pointer its self remains.
- */
-static inline void delete(list_t *restrict entry) attribute((always_inline,nonnull(1)));
-static inline void delete(list_t *restrict entry)
-{
- list_t * prev = entry->prev;
- list_t * next = entry->next;
-
- next->prev = prev;
- prev->next = next;
-
- initial(entry);
-}
-
-/*
- * Replace an entry by a new one.
- */
-static inline void replace(list_t *restrict old, list_t *restrict new) attribute((always_inline,nonnull(1,2)));
-static inline void replace(list_t *restrict old, list_t *restrict new)
-{
- new->next = old->next;
- new->next->prev = new;
- new->prev = old->prev;
- new->prev->next = new;
-}
-
-static inline void join(list_t *restrict list, list_t *restrict head) attribute((always_inline,nonnull(1,2)));
-static inline void join(list_t *restrict list, list_t *restrict head)
-{
- list_t * first = list->next;
-
- if (first != list) {
- list_t * last = list->prev;
- list_t * at = head->next;
-
- first->prev = head;
- head->next = first;
-
- last->next = at;
- at->prev = last;
- }
-}
-
-static inline boolean list_empty(const list_t *restrict const head) attribute((always_inline,nonnull(1)));
-static inline boolean list_empty(const list_t *restrict const head)
-{
- return head->next == head;
-}
-
-static inline void move_head(list_t *restrict entry, list_t *restrict head) attribute((always_inline,nonnull(1,2)));
-static inline void move_head(list_t *restrict entry, list_t *restrict head)
-{
- list_t * prev = entry->prev;
- list_t * next = entry->next;
-
- next->prev = prev; /* remove entry from old list */
- prev->next = next;
-
- prev = head;
- next = head->next;
-
- next->prev = entry; /* and add it at head of new list */
- entry->next = next;
- entry->prev = prev;
- prev->next = entry;
-}
-
-static inline void move_tail(list_t *restrict entry, list_t *restrict head) attribute((always_inline,nonnull(1,2)));
-static inline void move_tail(list_t *restrict entry, list_t *restrict head)
-{
- list_t * prev = entry->prev;
- list_t * next = entry->next;
-
- next->prev = prev; /* remove entry from old list */
- prev->next = next;
-
- prev = head->prev;
- next = head;
-
- next->prev = entry; /* and add it at tail of new list */
- entry->next = next;
- entry->prev = prev;
- prev->next = entry;
-}
-
-/*
- * The handle of the list is named `this'
- */
-#define list_entry(ptr, type) (__extension__ ({ \
- const typeof( ((type *)0)->this ) *__mptr = (ptr); \
- ((type *)( (char *)(__mptr) - offsetof(type,this) )); }))
-#define list_for_each(pos, head) \
- for (pos = (head)->next; prefetch(pos->next), pos != (head); pos = pos->next)
-#define np_list_for_each(pos, head) \
- for (pos = (head)->next; pos != (head); pos = pos->next)
-#define list_for_each_safe(pos, safe, head) \
- for (pos = (head)->next, safe = pos->next; pos != (head); pos = safe, safe = pos->next)
-#define list_for_each_prev(pos, head) \
- for (pos = (head)->prev; prefetch(pos->prev), pos != (head); pos = pos->prev)
-#define np_list_for_each_prev(pos, head) \
- for (pos = (head)->prev; pos != (head); pos = pos->prev)
-
-#endif /* _LISTS_H */
-/*
- * lists.h Simple doubly linked list implementation,
- * based on <linux/list.h> and <linux/prefetch.h>.
- *
- * Version: 0.1 01-Feb-2011 Fink
- *
- * Copyright 2011 Werner Fink, 2005 SUSE LINUX Products GmbH, Germany.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Author: Werner Fink <werner@suse.de>, 2011
- */
-
-#ifndef _LISTS_H
-#define _LISTS_H
-
-#include <stddef.h>
-#include <sys/types.h>
-
-typedef enum _boolean {false, true} boolean;
-typedef unsigned char uchar;
-#ifndef __USE_MISC
-typedef unsigned short ushort;
-typedef unsigned int uint;
-#endif
-
-#ifndef __OPTIMIZE__
-# warning This will not compile without -O at least
-#endif
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
-# ifndef inline
-# define inline __inline__
-# endif
-# ifndef restrict
-# define restrict __restrict__
-# endif
-# ifndef volatile
-# define volatile __volatile__
-# endif
-# ifndef asm
-# define asm __asm__
-# endif
-# ifndef extension
-# define extension __extension__
-# endif
-#endif
-#ifndef attribute
-# define attribute(attr) __attribute__(attr)
-#endif
-
-/*
- * This is lent from the kernel by e.g. using
- *
- * echo '#include <asm-i386/processor.h>\nint main () { prefetch(); return 0; }' | \
- * gcc -I/usr/src/linux/include -D__KERNEL__ -x c -E -P - | \
- * sed -rn '/void[[:blank:]]+prefetch[[:blank:]]*\(/,/^}/p'
- *
- * on the appropiate architecture (here on i686 for i586).
- */
-extern inline void attribute((used,__gnu_inline__,always_inline,__artificial__)) prefetch(const void *restrict x)
-{
-#if defined(__x86_64__)
- asm volatile ("prefetcht0 %0" :: "m" (*(unsigned long *)x))
-#elif defined(__ia64__)
- asm volatile ("lfetch [%0]" :: "r" (x))
-#elif defined(__powerpc64__)
- asm volatile ("dcbt 0,%0" :: "r" (x))
-#elif 1 && defined(__i386__)
+#elif !defined(__CYGWIN__) && defined(__i386__)
asm volatile ("661:\n\t"
".byte 0x8d,0x74,0x26,0x00\n"
"\n662:\n"
diff --git a/src/pstree.c b/src/pstree.c
index 39f345b..452f823 100644
--- a/src/pstree.c
+++ b/src/pstree.c
@@ -680,10 +680,10 @@ static void read_proc(void)
if ((taskdir = opendir(taskpath)) != 0) {
/* if we have this dir, we're on 2.6 */
- if (! (threadname = malloc(COMM_LEN+1))) {
+ if (! (threadname = malloc(COMM_LEN + 2 + 1))) {
exit(2);
}
- sprintf(threadname, "{%.*s}", COMM_LEN-2, comm);
+ sprintf(threadname, "{%.*s}", COMM_LEN, comm);
while ((dt = readdir(taskdir)) != NULL) {
if ((thread = atoi(dt->d_name)) != 0) {
if (thread != pid) {

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:22bbf4561837af475c0d8d14e3b9cab453998c787212c107fac7faf2f281e26e
size 382024

View File

@ -1,26 +1,5 @@
diff --git a/configure.ac b/configure.ac
index 6177975..d54f0ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,12 +26,12 @@ AC_SUBST([SELINUX_LIB])
dnl Call fork before all stat calls to stop hanging on NFS mounts
AC_SUBST([WITH_TIMEOUT_STAT])
-AC_ARG_ENABLE([TIMEOUT_STAT],
+AC_ARG_ENABLE([timeout_stat],
[AS_HELP_STRING([--enable-timeout-stat], [Use a timeout on stat calls])],
[enable_timeout_stat=$enableval],
[enable_timeout_stat="no"])
if test "$enable_timeout_stat" = "yes"; then
- AC_DEFINE([WITH_timeout_stat], [1], [Use timeout on stat calls])
+ AC_DEFINE([WITH_TIMEOUT_STAT], [1], [Use timeout on stat calls])
fi
dnl ipv4 only option
diff --git a/src/Makefile.am b/src/Makefile.am
index 4398631..bbe9170 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
--- src/Makefile.am
+++ src/Makefile.am 2012-02-27 00:00:00.000000000 +0000
@@ -23,7 +23,7 @@ if WANT_PEEKFD_MIPS
AM_CFLAGS += -DMIPS
endif
@ -30,10 +9,19 @@ index 4398631..bbe9170 100644
fuser_LDADD = @LIBINTL@
diff --git a/src/fuser.c b/src/fuser.c
index 476fdf1..374a17d 100644
--- a/src/fuser.c
+++ b/src/fuser.c
--- src/Makefile.in
+++ src/Makefile.in 2012-02-27 17:19:33.626434528 +0000
@@ -68,7 +68,7 @@ CONFIG_CLEAN_VPATH_FILES =
@WANT_PEEKFD_MIPS_TRUE@am__EXEEXT_5 = peekfd$(EXEEXT)
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
-am_fuser_OBJECTS = fuser.$(OBJEXT) signals.$(OBJEXT)
+am_fuser_OBJECTS = fuser.$(OBJEXT) signals.$(OBJEXT) timeout.$(OBJEXT)
fuser_OBJECTS = $(am_fuser_OBJECTS)
fuser_DEPENDENCIES =
am_killall_OBJECTS = killall.$(OBJEXT) signals.$(OBJEXT)
--- src/fuser.c
+++ src/fuser.c 2012-02-27 17:09:23.901933700 +0000
@@ -111,9 +111,8 @@ static dev_t device(const char *path);
#endif
static char *expandpath(const char *path);
@ -45,7 +33,7 @@ index 476fdf1..374a17d 100644
#else
#define timeout(func,path,buf,dummy) (func)((path),(buf))
#endif /* WITH_TIMEOUT_STAT */
@@ -1779,70 +1778,6 @@ scan_swaps(struct names *names_head, struct inode_list *ino_head,
@@ -1779,72 +1778,6 @@ scan_swaps(struct names *names_head, str
fclose(fp);
}
@ -53,6 +41,8 @@ index 476fdf1..374a17d 100644
- * Execute stat(2) system call with timeout to avoid deadlock
- * on network based file systems.
- */
-#ifdef HAVE_TIMEOUT_STAT
-
-static sigjmp_buf jenv;
-
-static void
@ -62,7 +52,6 @@ index 476fdf1..374a17d 100644
- siglongjmp(jenv, 1);
-}
-
-#ifdef HAVE_TIMEOUT_STAT
-static int
-timeout(stat_t func, const char *path, struct stat *buf, unsigned int seconds)
-{
@ -105,6 +94,7 @@ index 476fdf1..374a17d 100644
- (void) alarm(0);
- (void) signal(SIGALRM, SIG_DFL);
- close(pipes[0]);
- waitpid(pid, NULL, 0);
- break;
- }
- return ret;
@ -116,11 +106,9 @@ index 476fdf1..374a17d 100644
#ifdef _LISTS_H
/*
* Use /proc/self/mountinfo of modern linux system to determine
diff --git a/src/timeout.c b/src/timeout.c
index e69de29..bef93b3 100644
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -0,0 +1,265 @@
--- src/timeout.c
+++ src/timeout.c 2012-02-27 00:00:00.000000000 +0000
@@ -0,0 +1,267 @@
+/*
+ * timout.c Advanced timeout handling for file system calls
+ * to avoid deadlocks on remote file shares.
@ -294,6 +282,7 @@ index e69de29..bef93b3 100644
+ if (handle->function(handle->path, &handle->argument) < 0)
+ handle->errcode = errno;
+ write(STDOUT_FILENO, &handle->errcode, sizeof(handle->errcode)+sizeof(handle->argument));
+ memset(handle, 0, sizeof(handle_t));
+ }
+ }
+ sigprocmask(SIG_SETMASK, &oldset, NULL);
@ -329,6 +318,7 @@ index e69de29..bef93b3 100644
+ if (active <= 0) /* Oops, last one failed therefore clear status and restart */
+ start();
+
+ memset(handle, 0, sizeof(handle_t));
+ handle->len = strlen(path) + 1;
+ if (handle->len >= PATH_MAX) {
+ errno = ENAMETOOLONG;
@ -386,10 +376,8 @@ index e69de29..bef93b3 100644
+/*
+ * End of timeout.c
+ */
diff --git a/src/timeout.h b/src/timeout.h
index e69de29..546c13b 100644
--- a/src/timeout.h
+++ b/src/timeout.h
--- src/timeout.h
+++ src/timeout.h 2012-02-27 00:00:00.000000000 +0000
@@ -0,0 +1,36 @@
+/*
+ * timout.h Advanced timeout handling for file system calls

3
psmisc-22.16.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ae426d7238e5353fdf51b1d313897c2bbed0023e66e5b4af2be9cd03d87a9d01
size 465138

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Mon Feb 27 17:43:46 UTC 2012 - werner@suse.de
- Update to version 22.16
* Use strncpy for COMM_LEN and make it 18 characters to cover
brackets in name.
* don't change COMM_LEN, it breaks matching long commands
Debian #661145
* Enable some harden AM_CFLAGS by default, use configure option
--disable-harden-flags to not use it.
* Use ENOENT not EBADE for FreeBSD Debian #631566
* Fix prstat typos
* Stop zombies by using waitpid Ubuntu #876387 by Peter Holik, SF#3429674
* Fixed minor older/younger typo in killall.1 thanks to Maikel Linke
* Correct defines for timeout in configure.ac
-------------------------------------------------------------------
Thu Dec 1 15:57:50 UTC 2011 - coolo@suse.com

View File

@ -27,17 +27,16 @@ Url: http://sourceforge.net/projects/psmisc/
License: GPL-2.0+
Group: System/Monitoring
PreReq: %fillup_prereq %insserv_prereq
Version: 22.14
Release: 0
Version: 22.16
Release: 1
Provides: ps:/usr/bin/killall
Summary: Utilities for managing processes on your system
Source: http://sourceforge.net/projects/psmisc/files/psmisc/%{name}-%{version}.tar.gz
Patch0: %name-22.14.dif
Patch0: %name-22.16.dif
Patch1: %name-22.12-tigetstr.patch
Patch2: %name-22.12-pstree.patch
Patch3: pstree-segfault.patch
Patch42: %name-22.14-22.15.patch
Patch43: %name-22.15-timeout.patch
Patch42: %name-22.16-timeout.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define nopeek s390 s390x ia64 %sparc hppa
@ -52,12 +51,11 @@ processes that are using specified files or filesystems.
%prep
%setup -q
%patch42 -p1
%patch43 -p1 -b .to
%patch42 -p0 -b .to
%patch1 -p0 -b .tigetstr
%patch2 -p0 -b .pstree
%patch3 -p0 -b .comm
%patch0 -p0 -b .0
%patch3 -p1
%build
autoreconf -fi

View File

@ -1,19 +1,11 @@
From: Tetsuo Handa <from-suse@I-love.SAKURA.ne.jp>
See bnc#718915#c1
---
src/pstree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- psmisc-22.14.orig/src/pstree.c
+++ psmisc-22.14/src/pstree.c
@@ -70,7 +70,7 @@ extern const char *__progname;
#define VT_HD "w"
typedef struct _proc {
- char comm[COMM_LEN + 1];
+ char comm[COMM_LEN + 2 + 1]; /* add another 2 for thread brackets */
char **argv; /* only used : argv[0] is 1st arg; undef if argc < 1 */
int argc; /* with -a : number of arguments, -1 if swapped */
pid_t pid;
--- src/pstree.c
+++ src/pstree.c 2012-02-27 17:15:05.418433600 +0000
@@ -376,7 +376,7 @@ add_proc(const char *comm, pid_t pid, pi
#endif /*WITH_SELINUX */
else {
strncpy(this->comm, comm, COMM_LEN+2);
- this->comm[COMM_LEN+1];
+ this->comm[COMM_LEN+1]='\0';
this->uid = uid;
}
if (args)