mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-29 05:17:54 +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
|
Ackeret, Matt
|
||||||
Adler, Mark
|
Adler, Mark
|
||||||
Allbery, Russ
|
Allbery, Russ
|
||||||
|
Anderson, Jamie
|
||||||
Andrew, Nick
|
Andrew, Nick
|
||||||
Andric, Dimitry
|
Andric, Dimitry
|
||||||
Barron, Danny
|
Barron, Danny
|
||||||
|
@ -65,8 +65,9 @@ get_boottime(struct timeval *tv)
|
|||||||
{
|
{
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
size_t linesize = 0;
|
size_t linesize = 0;
|
||||||
|
bool found = false;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
FILE * fp;
|
FILE *fp;
|
||||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL)
|
debug_decl(get_boottime, SUDO_DEBUG_UTIL)
|
||||||
|
|
||||||
/* read btime from /proc/stat */
|
/* read btime from /proc/stat */
|
||||||
@ -78,7 +79,8 @@ get_boottime(struct timeval *tv)
|
|||||||
if (llval > 0) {
|
if (llval > 0) {
|
||||||
tv->tv_sec = (time_t)llval;
|
tv->tv_sec = (time_t)llval;
|
||||||
tv->tv_usec = 0;
|
tv->tv_usec = 0;
|
||||||
debug_return_bool(1);
|
found = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,7 +88,7 @@ get_boottime(struct timeval *tv)
|
|||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_return_bool(0);
|
debug_return_bool(found);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(HAVE_SYSCTL) && defined(KERN_BOOTTIME)
|
#elif defined(HAVE_SYSCTL) && defined(KERN_BOOTTIME)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user