mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cov: use different variable name
Better for Coverity to see no change for possibly opened handle.
This commit is contained in:
parent
376e707232
commit
825e49a244
@ -326,7 +326,7 @@ static void _remove_lockfile(const char *file)
|
||||
static void _daemonise(daemon_state s)
|
||||
{
|
||||
int child_status;
|
||||
int fd;
|
||||
int fd, ffd;
|
||||
pid_t pid;
|
||||
struct rlimit rlim;
|
||||
struct timeval tval;
|
||||
@ -394,17 +394,17 @@ static void _daemonise(daemon_state s)
|
||||
|
||||
/* Switch to sysconf(_SC_OPEN_MAX) ?? */
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlim) < 0)
|
||||
fd = 256; /* just have to guess */
|
||||
ffd = 256; /* just have to guess */
|
||||
else
|
||||
fd = rlim.rlim_cur;
|
||||
ffd = rlim.rlim_cur;
|
||||
|
||||
for (--fd; fd > STDERR_FILENO; fd--) {
|
||||
for (--ffd; ffd > STDERR_FILENO; ffd--) {
|
||||
#ifdef __linux__
|
||||
/* Do not close fds preloaded by systemd! */
|
||||
if (_systemd_activation && fd == SD_FD_SOCKET_SERVER)
|
||||
if (_systemd_activation && ffd == SD_FD_SOCKET_SERVER)
|
||||
continue;
|
||||
#endif
|
||||
(void) close(fd);
|
||||
(void) close(ffd);
|
||||
}
|
||||
|
||||
setsid();
|
||||
|
@ -629,7 +629,7 @@ check_unlinked:
|
||||
static int _daemonise(struct filemap_monitor *fm)
|
||||
{
|
||||
pid_t pid = 0;
|
||||
int fd;
|
||||
int fd, ffd;
|
||||
|
||||
if (!setsid()) {
|
||||
_early_log("setsid failed.");
|
||||
@ -670,10 +670,10 @@ static int _daemonise(struct filemap_monitor *fm)
|
||||
(void) close(fd);
|
||||
}
|
||||
/* TODO: Use libdaemon/server/daemon-server.c _daemonise() */
|
||||
for (fd = (int) sysconf(_SC_OPEN_MAX) - 1; fd > STDERR_FILENO; fd--) {
|
||||
if (fd == fm->fd)
|
||||
for (ffd = (int) sysconf(_SC_OPEN_MAX) - 1; ffd > STDERR_FILENO; --ffd) {
|
||||
if (ffd == fm->fd)
|
||||
continue;
|
||||
(void) close(fd);
|
||||
(void) close(ffd);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user