1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-08 08:58:50 +03:00

Few more close and dev_close trace

Adding (void) where we cannot really report an error.
This commit is contained in:
Zdenek Kabelac 2012-03-01 21:12:37 +00:00
parent bea2f61935
commit c452307543
8 changed files with 28 additions and 19 deletions

View File

@ -1052,11 +1052,11 @@ static void be_daemon(int timeout)
exit(2);
case 0: /* Child */
close(child_pipe[0]);
(void) close(child_pipe[0]);
break;
default: /* Parent */
close(child_pipe[1]);
(void) close(child_pipe[1]);
wait_for_child(child_pipe[0], timeout);
}
@ -1140,8 +1140,8 @@ static int read_from_local_sock(struct local_client *thisfd)
struct local_client *lastfd = NULL;
struct local_client *free_fd = NULL;
close(thisfd->bits.localsock.pipe_client->fd); /* Close pipe */
close(thisfd->bits.localsock.pipe);
(void) close(thisfd->bits.localsock.pipe_client->fd); /* Close pipe */
(void) close(thisfd->bits.localsock.pipe);
/* Remove pipe client */
for (newfd = &local_client_head; newfd != NULL;
@ -1329,8 +1329,8 @@ static int read_from_local_sock(struct local_client *thisfd)
.status = ENOMEM
};
close(comms_pipe[0]);
close(comms_pipe[1]);
(void) close(comms_pipe[0]);
(void) close(comms_pipe[1]);
send_message(&reply, sizeof(reply), our_csid,
thisfd->fd,
@ -2107,7 +2107,9 @@ static int check_local_clvmd(void)
ret = -1;
}
close(local_socket);
if (close(local_socket))
log_sys_error("close", "local socket");
return ret;
}

View File

@ -1803,7 +1803,7 @@ static void _daemonize(void)
(fd == SD_FD_FIFO_SERVER || fd == SD_FD_FIFO_CLIENT))
continue;
#endif
close(fd);
(void) close(fd);
}
if ((open("/dev/null", O_RDONLY) < 0) ||

View File

@ -150,7 +150,8 @@ void config_file_destroy(struct dm_config_tree *cft)
struct config_file *cf = dm_config_get_custom(cft);
if (cf && cf->dev)
dev_close(cf->dev);
if (!dev_close(cf->dev))
stack;
dm_config_destroy(cft);
}
@ -275,7 +276,8 @@ int config_file_read(struct dm_config_tree *cft)
(checksum_fn_t) NULL, 0);
if (!cf->keep_open) {
dev_close(cf->dev);
if (!dev_close(cf->dev))
stack;
cf->dev = NULL;
}

View File

@ -161,7 +161,8 @@ static int _do_flock(const char *file, int *fd, int operation, uint32_t nonblock
if (r) {
errno = old_errno;
log_sys_error("flock", file);
close(*fd);
if (close(*fd))
log_sys_error("close", file);
return 0;
}

View File

@ -110,7 +110,7 @@ void release_log_memory(void)
void fin_log(void)
{
if (_log_direct) {
dev_close(&_log_dev);
(void) dev_close(&_log_dev);
_log_direct = 0;
}

View File

@ -57,7 +57,8 @@ daemon_handle daemon_open(daemon_info i) {
error:
h.error = errno;
if (h.socket_fd >= 0)
close(h.socket_fd);
if (close(h.socket_fd))
perror("close");
if (r.cft)
daemon_reply_destroy(r);
h.socket_fd = -1;

View File

@ -306,7 +306,7 @@ static void _daemonise(void)
if (_systemd_activation && fd == SD_FD_SOCKET_SERVER)
continue;
#endif
close(fd);
(void) close(fd);
}
if ((open("/dev/null", O_RDONLY) < 0) ||
@ -407,7 +407,8 @@ static void *client_thread(void *baton)
}
fail:
/* TODO what should we really do here? */
close(b->client.socket_fd);
if (close(b->client.socket_fd))
perror("close");
free(baton);
return NULL;
}

View File

@ -72,11 +72,13 @@ static int _check_device(struct cmd_context *cmd, struct device *dev)
char buffer;
uint64_t size;
if (!dev_open_readonly(dev)) {
return 0;
}
if (!dev_open_readonly(dev))
return_0;
if (!dev_read(dev, UINT64_C(0), (size_t) 1, &buffer)) {
dev_close(dev);
stack;
if (!dev_close(dev))
stack;
return 0;
}
if (!dev_get_size(dev, &size)) {