Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324438
b: refs/heads/master
c: 436473b
h: refs/heads/master
v: v3
  • Loading branch information
Ben Hutchings authored and Greg Kroah-Hartman committed Sep 10, 2012
1 parent 3015452 commit 2e5e98e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6bb22fea25624ab593eee376fa5fb82d1b13f45a
refs/heads/master: 436473bc2173499ae274d0f50111d1e355006caf
22 changes: 19 additions & 3 deletions trunk/tools/hv/hv_kvp_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ static void kvp_update_file(int pool)
sizeof(struct kvp_record),
kvp_file_info[pool].num_records, filep);

fclose(filep);
if (ferror(filep) || fclose(filep)) {
kvp_release_lock(pool);
syslog(LOG_ERR, "Failed to write file, pool: %d", pool);
exit(EXIT_FAILURE);
}

kvp_release_lock(pool);
}

Expand All @@ -181,12 +186,17 @@ static void kvp_update_mem_state(int pool)
syslog(LOG_ERR, "Failed to open file, pool: %d", pool);
exit(EXIT_FAILURE);
}
while (!feof(filep)) {
for (;;) {
readp = &record[records_read];
records_read += fread(readp, sizeof(struct kvp_record),
ENTRIES_PER_BLOCK * num_blocks,
filep);

if (ferror(filep)) {
syslog(LOG_ERR, "Failed to read file, pool: %d", pool);
exit(EXIT_FAILURE);
}

if (!feof(filep)) {
/*
* We have more data to read.
Expand Down Expand Up @@ -249,12 +259,18 @@ static int kvp_file_init(void)
fclose(filep);
return 1;
}
while (!feof(filep)) {
for (;;) {
readp = &record[records_read];
records_read += fread(readp, sizeof(struct kvp_record),
ENTRIES_PER_BLOCK,
filep);

if (ferror(filep)) {
syslog(LOG_ERR, "Failed to read file, pool: %d",
i);
exit(EXIT_FAILURE);
}

if (!feof(filep)) {
/*
* We have more data to read.
Expand Down

0 comments on commit 2e5e98e

Please sign in to comment.