From cdce5d216dd71a7cb2c6ee05562d282b03365a0c Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Sun, 11 Aug 2013 19:51:02 +0400 Subject: [PATCH] util: Make set_proc_fd report success/error only Returning the new proc fd value is useless. Signed-off-by: Pavel Emelyanov --- cr-dump.c | 9 +++------ util.c | 4 +++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cr-dump.c b/cr-dump.c index c9ae18787..671782d30 100644 --- a/cr-dump.c +++ b/cr-dump.c @@ -1274,14 +1274,11 @@ static int fill_zombies_pids(struct pstree_item *item) static int dump_zombies(void) { struct pstree_item *item; - int oldfd, ret = -1; + int ret = -1; int pidns = current_ns_mask & CLONE_NEWPID; - if (pidns) { - oldfd = set_proc_fd(pidns_proc); - if (oldfd < 0) - return -1; - } + if (pidns && set_proc_fd(pidns_proc)) + return -1; for_each_pstree_item(item) { if (item->state != TASK_DEAD) diff --git a/util.c b/util.c index 74c14ac7e..5794847ef 100644 --- a/util.c +++ b/util.c @@ -179,7 +179,9 @@ void close_proc() int set_proc_fd(int fd) { - return install_service_fd(PROC_FD_OFF, fd); + if (install_service_fd(PROC_FD_OFF, fd) < 0) + return -1; + return 0; } int set_proc_mountpoint(char *path)