mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Add some log_sys_errors to close() call
This commit is contained in:
parent
75f8f3ce8b
commit
8918bf2430
@ -198,7 +198,8 @@ static void safe_close(int *fd)
|
||||
if (*fd >= 0) {
|
||||
int to_close = *fd;
|
||||
*fd = -1;
|
||||
close(to_close);
|
||||
if (close(to_close))
|
||||
log_sys_error("close", ""); /* path */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,8 @@ int fcntl_lock_file(const char *file, short lock_type, int warn_if_read_only)
|
||||
|
||||
if (fcntl(lockfd, F_SETLKW, &lock)) {
|
||||
log_sys_error("fcntl", file);
|
||||
close(lockfd);
|
||||
if (close(lockfd))
|
||||
log_sys_error("close", file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -3240,7 +3240,8 @@ static int _loop_table(char *table, size_t tlen, char *file,
|
||||
blksize = fsbuf.f_frsize;
|
||||
#endif
|
||||
|
||||
close(fd);
|
||||
if (close(fd))
|
||||
log_sys_error("close", file);
|
||||
|
||||
if (dm_snprintf(table, tlen, "%llu %llu loop %s %llu\n", 0ULL,
|
||||
(long long unsigned)sectors, file, (long long unsigned)off) < 0)
|
||||
@ -3252,8 +3253,9 @@ static int _loop_table(char *table, size_t tlen, char *file,
|
||||
return 1;
|
||||
|
||||
error:
|
||||
if (fd > -1)
|
||||
close(fd);
|
||||
if (fd > -1 && close(fd))
|
||||
log_sys_error("close", file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user