Commit 54c087e9 authored by Rusty Russell's avatar Rusty Russell

tdb2: fix gcc -O3 warnings on test/layout.c

Warnings about ignored returns, and uninitialized len after case statement.
parent b10598eb
......@@ -237,6 +237,8 @@ struct tdb_context *tdb_layout_get(struct tdb_layout *layout)
case HASHTABLE:
len = hashtable_len(&e->hashtable);
break;
default:
abort();
}
off += len;
assert(zone_left >= len);
......@@ -311,7 +313,8 @@ struct tdb_context *tdb_layout_get(struct tdb_layout *layout)
0600);
if (fd < 0)
err(1, "opening %s for writing", layout->filename);
write(fd, tdb->map_ptr, tdb->map_size);
if (write(fd, tdb->map_ptr, tdb->map_size) != tdb->map_size)
err(1, "writing %s", layout->filename);
close(fd);
tdb_close(tdb);
/* NOMMAP is for lockcheck. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment