mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
cmirrord: add test for closedir() and close()
This commit is contained in:
parent
e77803edc9
commit
fb4584b83d
@ -1,5 +1,6 @@
|
||||
Version 2.02.97 -
|
||||
===============================
|
||||
Add tests for errors from closedir(), close() in cmirrord.
|
||||
Fix missing sync of filesystem when creating thin volume snapshot.
|
||||
|
||||
Version 2.02.96 - 8th June 2012
|
||||
|
@ -337,14 +337,18 @@ static int find_disk_path(char *major_minor_str, char *path_rtn, int *unlink_pat
|
||||
(major(statbuf.st_rdev) == major) &&
|
||||
(minor(statbuf.st_rdev) == minor)) {
|
||||
LOG_DBG(" %s: YES", dep->d_name);
|
||||
closedir(dp);
|
||||
if (closedir(dp))
|
||||
LOG_DBG("Unable to closedir /dev/mapper %s",
|
||||
strerror(errno));
|
||||
return 0;
|
||||
} else {
|
||||
LOG_DBG(" %s: NO", dep->d_name);
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dp);
|
||||
if (closedir(dp))
|
||||
LOG_DBG("Unable to closedir /dev/mapper %s",
|
||||
strerror(errno));
|
||||
|
||||
/* FIXME Find out why this was here and deal with underlying problem. */
|
||||
LOG_DBG("Path not found for %d/%d", major, minor);
|
||||
@ -640,8 +644,9 @@ static int clog_dtr(struct dm_ulog_request *rq)
|
||||
LOG_DBG("[%s] Cluster log removed", SHORT_UUID(lc->uuid));
|
||||
|
||||
dm_list_del(&lc->list);
|
||||
if (lc->disk_fd != -1)
|
||||
close(lc->disk_fd);
|
||||
if (lc->disk_fd != -1 && close(lc->disk_fd))
|
||||
LOG_ERROR("Failed to close disk log: %s",
|
||||
strerror(errno));
|
||||
if (lc->disk_buffer)
|
||||
free(lc->disk_buffer);
|
||||
dm_free(lc->clean_bits);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#define CN_VAL_DM_USERSPACE_LOG 0x1
|
||||
#endif
|
||||
|
||||
static int cn_fd; /* Connector (netlink) socket fd */
|
||||
static int cn_fd = -1; /* Connector (netlink) socket fd */
|
||||
static char recv_buf[2048];
|
||||
static char send_buf[2048];
|
||||
|
||||
@ -384,14 +384,18 @@ int init_local(void)
|
||||
|
||||
r = bind(cn_fd, (struct sockaddr *) &addr, sizeof(addr));
|
||||
if (r < 0) {
|
||||
close(cn_fd);
|
||||
if (close(cn_fd))
|
||||
LOG_ERROR("Failed to close socket: %s",
|
||||
strerror(errno));
|
||||
return EXIT_KERNEL_BIND;
|
||||
}
|
||||
|
||||
opt = addr.nl_groups;
|
||||
r = setsockopt(cn_fd, 270, NETLINK_ADD_MEMBERSHIP, &opt, sizeof(opt));
|
||||
if (r) {
|
||||
close(cn_fd);
|
||||
if (close(cn_fd))
|
||||
LOG_ERROR("Failed to close socket: %s",
|
||||
strerror(errno));
|
||||
return EXIT_KERNEL_SETSOCKOPT;
|
||||
}
|
||||
|
||||
@ -412,5 +416,7 @@ int init_local(void)
|
||||
void cleanup_local(void)
|
||||
{
|
||||
links_unregister(cn_fd);
|
||||
close(cn_fd);
|
||||
if (cn_fd >= 0 && close(cn_fd))
|
||||
LOG_ERROR("Failed to close socket: %s",
|
||||
strerror(errno));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user