diff options
author | Michal Zidek <mzidek@redhat.com> | 2012-07-30 18:17:02 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2012-08-03 11:10:25 +0200 |
commit | 2e1b46d7acb03b22b27bbad2816b996db629d609 (patch) | |
tree | d399e472ea6e68e809ef64b23edd89af24d07bd5 /src | |
parent | 1bb7735288ab75ddb8ce6875a6e1c7e2dd65a010 (diff) | |
download | sssd-2e1b46d7acb03b22b27bbad2816b996db629d609.tar.gz sssd-2e1b46d7acb03b22b27bbad2816b996db629d609.tar.bz2 sssd-2e1b46d7acb03b22b27bbad2816b996db629d609.zip |
Return value of fread in src/tools/sss_debuglevel.c no longer ignored.
https://fedorahosted.org/sssd/ticket/1426
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/sss_debuglevel.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tools/sss_debuglevel.c b/src/tools/sss_debuglevel.c index 603ae166..908518b1 100644 --- a/src/tools/sss_debuglevel.c +++ b/src/tools/sss_debuglevel.c @@ -319,6 +319,7 @@ fail: errno_t get_sssd_pid(pid_t *out_pid) { int ret; + size_t fsize; FILE *pid_file = NULL; char pid_str[MAX_PID_LENGTH] = {'\0'}; @@ -333,7 +334,8 @@ errno_t get_sssd_pid(pid_t *out_pid) goto done; } - fread(pid_str, sizeof(char), MAX_PID_LENGTH * sizeof(char), pid_file); + fsize = fread(pid_str, sizeof(char), MAX_PID_LENGTH * sizeof(char), + pid_file); if (!feof(pid_file)) { /* eof not reached */ ret = ferror(pid_file); @@ -346,6 +348,12 @@ errno_t get_sssd_pid(pid_t *out_pid) } goto done; } + if (fsize == 0) { + DEBUG(SSSDBG_CRIT_FAILURE, ("File \"%s\" contains no pid.\n", + SSSD_PIDFILE)); + ret = EINVAL; + goto done; + } pid_str[MAX_PID_LENGTH-1] = '\0'; *out_pid = parse_pid(pid_str); |