mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 01:49:11 +00:00
Fix fd leak on Linux when determing boot time. This is usually
masked by the closefrom() call in sudo. From Jamie Anderson. Bug #645
This commit is contained in:
parent
d3b4326713
commit
e61af9e6d0
@ -6,6 +6,7 @@ you believe you should be listed, please send a note to sudo@sudo.ws.
|
||||
Ackeret, Matt
|
||||
Adler, Mark
|
||||
Allbery, Russ
|
||||
Anderson, Jamie
|
||||
Andrew, Nick
|
||||
Andric, Dimitry
|
||||
Barron, Danny
|
||||
|
@ -65,8 +65,9 @@ get_boottime(struct timeval *tv)
|
||||
{
|
||||
char *line = NULL;
|
||||
size_t linesize = 0;
|
||||
bool found = false;
|
||||
ssize_t len;
|
||||
FILE * fp;
|
||||
FILE *fp;
|
||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL)
|
||||
|
||||
/* read btime from /proc/stat */
|
||||
@ -78,7 +79,8 @@ get_boottime(struct timeval *tv)
|
||||
if (llval > 0) {
|
||||
tv->tv_sec = (time_t)llval;
|
||||
tv->tv_usec = 0;
|
||||
debug_return_bool(1);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -86,7 +88,7 @@ get_boottime(struct timeval *tv)
|
||||
free(line);
|
||||
}
|
||||
|
||||
debug_return_bool(0);
|
||||
debug_return_bool(found);
|
||||
}
|
||||
|
||||
#elif defined(HAVE_SYSCTL) && defined(KERN_BOOTTIME)
|
||||
|
Loading…
x
Reference in New Issue
Block a user