[SSSD] [PATCH] Do not treat missing proc files as errors
Sumit Bose
sbose at redhat.com
Fri Dec 4 12:15:21 UTC 2009
Hi,
the /proc files of the process will not be available anymore when the
process is gone. This patch handles ENOENT special when searching for
active uids.
bye,
Sumit
-------------- next part --------------
From 882ae44245db3e957cdb93a03c421b7d0421e880 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Fri, 4 Dec 2009 13:01:09 +0100
Subject: [PATCH] Do not treat missing proc files as errors.
---
server/util/find_uid.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/server/util/find_uid.c b/server/util/find_uid.c
index 2fead50..626d37f 100644
--- a/server/util/find_uid.c
+++ b/server/util/find_uid.c
@@ -87,6 +87,11 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid)
ret = lstat(path, &stat_buf);
if (ret == -1) {
+ if (errno == ENOENT) {
+ DEBUG(7, ("Proc file [%s] is not available anymore, continuing.\n",
+ path));
+ return EOK;
+ }
DEBUG(1, ("lstat failed [%d][%s].\n", errno, strerror(errno)));
return errno;
}
@@ -98,6 +103,11 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid)
fd = open(path, O_RDONLY);
if (fd == -1) {
+ if (errno == ENOENT) {
+ DEBUG(7, ("Proc file [%s] is not available anymore, continuing.\n",
+ path));
+ return EOK;
+ }
DEBUG(1, ("open failed [%d][%s].\n", errno, strerror(errno)));
return errno;
}
--
1.6.5.2
More information about the sssd-devel
mailing list