mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
Add some missing close() and fclose() return value checks.
This commit is contained in:
parent
00fc37f183
commit
232da7ecc7
@ -1,5 +1,6 @@
|
|||||||
Version 1.02.16 -
|
Version 1.02.16 -
|
||||||
===================================
|
===================================
|
||||||
|
Add some missing close() and fclose() return value checks.
|
||||||
Migrate dmsetup column-based output over to new libdevmapper report framework.
|
Migrate dmsetup column-based output over to new libdevmapper report framework.
|
||||||
Add descriptions to reporting field definitions.
|
Add descriptions to reporting field definitions.
|
||||||
Add a dso-private variable to dmeventd dso interface.
|
Add a dso-private variable to dmeventd dso interface.
|
||||||
|
@ -1566,7 +1566,8 @@ static int _set_oom_adj(int val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fp, "%i", val);
|
fprintf(fp, "%i", val);
|
||||||
fclose(fp);
|
if (fclose(fp))
|
||||||
|
perror(OOM_ADJ_FILE ": fclose failed");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1583,7 +1584,7 @@ static void _daemonize(void)
|
|||||||
|
|
||||||
sigemptyset(&my_sigset);
|
sigemptyset(&my_sigset);
|
||||||
if (sigprocmask(SIG_SETMASK, &my_sigset, NULL) < 0) {
|
if (sigprocmask(SIG_SETMASK, &my_sigset, NULL) < 0) {
|
||||||
fprintf(stderr, "Unable to restore signals.");
|
fprintf(stderr, "Unable to restore signals.\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
signal(SIGTERM, &_exit_handler);
|
signal(SIGTERM, &_exit_handler);
|
||||||
|
@ -149,7 +149,8 @@ static int _get_proc_number(const char *file, const char *name,
|
|||||||
if (!strcmp(name, nm)) {
|
if (!strcmp(name, nm)) {
|
||||||
if (number) {
|
if (number) {
|
||||||
*number = num;
|
*number = num;
|
||||||
fclose(fl);
|
if (fclose(fl))
|
||||||
|
log_error("%s: fclose failed: %s", file, strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
dm_bit_set(_dm_bitset, num);
|
dm_bit_set(_dm_bitset, num);
|
||||||
@ -158,7 +159,8 @@ static int _get_proc_number(const char *file, const char *name,
|
|||||||
c = fgetc(fl);
|
c = fgetc(fl);
|
||||||
} while (c != EOF && c != '\n');
|
} while (c != EOF && c != '\n');
|
||||||
}
|
}
|
||||||
fclose(fl);
|
if (fclose(fl))
|
||||||
|
log_error("%s: fclose failed: %s", file, strerror(errno));
|
||||||
|
|
||||||
if (number) {
|
if (number) {
|
||||||
log_error("%s: No entry for %s found", file, name);
|
log_error("%s: No entry for %s found", file, name);
|
||||||
@ -1322,7 +1324,7 @@ static int _process_mapper_dir(struct dm_task *dmt)
|
|||||||
|
|
||||||
dir = dm_dir();
|
dir = dm_dir();
|
||||||
if (!(d = opendir(dir))) {
|
if (!(d = opendir(dir))) {
|
||||||
fprintf(stderr, "opendir %s: %s", dir, strerror(errno));
|
log_error("opendir %s: %s", dir, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1335,9 +1337,8 @@ static int _process_mapper_dir(struct dm_task *dmt)
|
|||||||
dm_task_run(dmt);
|
dm_task_run(dmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (closedir(d)) {
|
if (closedir(d))
|
||||||
fprintf(stderr, "closedir %s: %s", dir, strerror(errno));
|
log_error("closedir %s: %s", dir, strerror(errno));
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -231,8 +231,9 @@ static int _parse_file(struct dm_task *dmt, const char *file)
|
|||||||
#else
|
#else
|
||||||
free(buffer);
|
free(buffer);
|
||||||
#endif
|
#endif
|
||||||
if (file)
|
if (file && fclose(fp))
|
||||||
fclose(fp);
|
fprintf(stderr, "%s: fclose failed: %s", file, strerror(errno));
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1479,7 +1480,7 @@ static int _tree(int argc, char **argv, void *data __attribute((unused)))
|
|||||||
static int _int32_disp(struct dm_report *rh,
|
static int _int32_disp(struct dm_report *rh,
|
||||||
struct dm_pool *mem __attribute((unused)),
|
struct dm_pool *mem __attribute((unused)),
|
||||||
struct dm_report_field *field, const void *data,
|
struct dm_report_field *field, const void *data,
|
||||||
void *private)
|
void *private __attribute((unused)))
|
||||||
{
|
{
|
||||||
const int32_t value = *(const int32_t *)data;
|
const int32_t value = *(const int32_t *)data;
|
||||||
|
|
||||||
@ -1489,7 +1490,7 @@ static int _int32_disp(struct dm_report *rh,
|
|||||||
static int _uint32_disp(struct dm_report *rh,
|
static int _uint32_disp(struct dm_report *rh,
|
||||||
struct dm_pool *mem __attribute((unused)),
|
struct dm_pool *mem __attribute((unused)),
|
||||||
struct dm_report_field *field, const void *data,
|
struct dm_report_field *field, const void *data,
|
||||||
void *private)
|
void *private __attribute((unused)))
|
||||||
{
|
{
|
||||||
const uint32_t value = *(const int32_t *)data;
|
const uint32_t value = *(const int32_t *)data;
|
||||||
|
|
||||||
@ -1499,7 +1500,7 @@ static int _uint32_disp(struct dm_report *rh,
|
|||||||
static int _dm_name_disp(struct dm_report *rh,
|
static int _dm_name_disp(struct dm_report *rh,
|
||||||
struct dm_pool *mem __attribute((unused)),
|
struct dm_pool *mem __attribute((unused)),
|
||||||
struct dm_report_field *field, const void *data,
|
struct dm_report_field *field, const void *data,
|
||||||
void *private)
|
void *private __attribute((unused)))
|
||||||
{
|
{
|
||||||
const char *name = dm_task_get_name((struct dm_task *) data);
|
const char *name = dm_task_get_name((struct dm_task *) data);
|
||||||
|
|
||||||
@ -1509,7 +1510,7 @@ static int _dm_name_disp(struct dm_report *rh,
|
|||||||
static int _dm_uuid_disp(struct dm_report *rh,
|
static int _dm_uuid_disp(struct dm_report *rh,
|
||||||
struct dm_pool *mem __attribute((unused)),
|
struct dm_pool *mem __attribute((unused)),
|
||||||
struct dm_report_field *field,
|
struct dm_report_field *field,
|
||||||
const void *data, void *private)
|
const void *data, void *private __attribute((unused)))
|
||||||
{
|
{
|
||||||
const char *uuid = dm_task_get_uuid((struct dm_task *) data);
|
const char *uuid = dm_task_get_uuid((struct dm_task *) data);
|
||||||
|
|
||||||
@ -1522,7 +1523,7 @@ static int _dm_uuid_disp(struct dm_report *rh,
|
|||||||
static int _dm_info_status_disp(struct dm_report *rh,
|
static int _dm_info_status_disp(struct dm_report *rh,
|
||||||
struct dm_pool *mem __attribute((unused)),
|
struct dm_pool *mem __attribute((unused)),
|
||||||
struct dm_report_field *field, const void *data,
|
struct dm_report_field *field, const void *data,
|
||||||
void *private)
|
void *private __attribute((unused)))
|
||||||
{
|
{
|
||||||
char buf[5];
|
char buf[5];
|
||||||
const char *s = buf;
|
const char *s = buf;
|
||||||
@ -1607,7 +1608,7 @@ static int _report_init(struct command *c)
|
|||||||
options = _string_args[OPTIONS_ARG];
|
options = _string_args[OPTIONS_ARG];
|
||||||
else {
|
else {
|
||||||
len = strlen(default_report_options) +
|
len = strlen(default_report_options) +
|
||||||
strlen(_string_args[OPTIONS_ARG]);
|
strlen(_string_args[OPTIONS_ARG]) + 1;
|
||||||
if (!(options = dm_malloc(len))) {
|
if (!(options = dm_malloc(len))) {
|
||||||
err("Failed to allocate option string.");
|
err("Failed to allocate option string.");
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user