summaryrefslogtreecommitdiffstats
path: root/src/util/find_uid.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2010-06-10 11:25:15 +0200
committerStephen Gallagher <sgallagh@redhat.com>2010-06-14 16:54:31 -0400
commit0d32e0dbb84de09e819911e8a5a532fbb7c1604e (patch)
tree395917b665d4ebdbeb812bcd83ccb6a6c27ad393 /src/util/find_uid.c
parent7d2f90122754a2b0ef21671d68a9fa98fbe8d4a8 (diff)
downloadsssd-0d32e0dbb84de09e819911e8a5a532fbb7c1604e.tar.gz
sssd-0d32e0dbb84de09e819911e8a5a532fbb7c1604e.tar.xz
sssd-0d32e0dbb84de09e819911e8a5a532fbb7c1604e.zip
Check closedir call in find_uid
Fixes: #503
Diffstat (limited to 'src/util/find_uid.c')
-rw-r--r--src/util/find_uid.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/util/find_uid.c b/src/util/find_uid.c
index 6f43ac388..02d668636 100644
--- a/src/util/find_uid.c
+++ b/src/util/find_uid.c
@@ -197,7 +197,7 @@ static errno_t get_active_uid_linux(hash_table_t *table, uid_t search_uid)
{
DIR *proc_dir = NULL;
struct dirent *dirent;
- int ret;
+ int ret, err;
pid_t pid = -1;
uid_t uid;
@@ -250,14 +250,14 @@ static errno_t get_active_uid_linux(hash_table_t *table, uid_t search_uid)
}
if (errno != 0 && dirent == NULL) {
ret = errno;
- DEBUG(1 ,("readdir failed.\n"));
+ DEBUG(1, ("readdir failed.\n"));
goto done;
}
ret = closedir(proc_dir);
proc_dir = NULL;
if (ret == -1) {
- DEBUG(1 ,("closedir failed, watch out.\n"));
+ DEBUG(1, ("closedir failed, watch out.\n"));
}
if (table != NULL) {
@@ -267,7 +267,12 @@ static errno_t get_active_uid_linux(hash_table_t *table, uid_t search_uid)
}
done:
- if (proc_dir != NULL) closedir(proc_dir);
+ if (proc_dir != NULL) {
+ err = closedir(proc_dir);
+ if (err) {
+ DEBUG(1, ("closedir failed, bad dirp?\n"));
+ }
+ }
return ret;
}