chunk: Externalize error reporting in chunk_write()

This avoids passing that arbitrary label just for error messages, and gives
greater flexibility in handling errors.
This commit is contained in:
Martin Willi
2014-01-23 15:55:32 +01:00
parent 37374a292a
commit b9ee059ca9
6 changed files with 52 additions and 30 deletions
+2 -2
View File
@@ -789,7 +789,7 @@ START_TEST(test_chunk_map)
chunk_t *map, contents = chunk_from_chars(0x01,0x02,0x03,0x04,0x05);
char *path = "/tmp/strongswan-chunk-map-test";
ck_assert(chunk_write(contents, path, "chunk_map", 022, TRUE));
ck_assert(chunk_write(contents, path, 022, TRUE));
/* read */
map = chunk_map(path, FALSE);
@@ -827,7 +827,7 @@ START_TEST(test_chunk_from_fd_file)
char *path = "/tmp/strongswan-chunk-fd-test";
int fd;
ck_assert(chunk_write(contents, path, "chunk_fd", 022, TRUE));
ck_assert(chunk_write(contents, path, 022, TRUE));
fd = open(path, O_RDONLY);
ck_assert(fd != -1);