diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-01-28 18:23:38 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-01-28 19:07:12 -0500 |
commit | 87b0284327e34a4b96c22085fa2cdb3219294991 (patch) | |
tree | 3dfa856eb4ee93e6e7808f442a7dd14daff00d8e /src/test/test-util.c | |
parent | 7b36bf82c4deeadef6d914cef750b4a51ff2ed48 (diff) |
Get rid of write_safe
Current glibc implementation is safe. Kernel does this atomically,
and write is actually implemented through writev. So if write is
async-signal-safe, than writev pretty much must be too.
Diffstat (limited to 'src/test/test-util.c')
-rw-r--r-- | src/test/test-util.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c index 43bb0249a2..9d6f4be502 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -580,8 +580,8 @@ static void test_in_set(void) { assert_se(!IN_SET(0, 1, 2, 3, 4)); } -static void test_writev_safe(void) { - char name[] = "/tmp/test-writev_safe.XXXXXX"; +static void test_writing_tmpfile(void) { + char name[] = "/tmp/test-systemd_writing_tmpfile.XXXXXX"; _cleanup_free_ char *contents; size_t size; int fd, r; @@ -592,10 +592,10 @@ static void test_writev_safe(void) { IOVEC_SET_STRING(iov[2], ""); fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC); - printf("test_writev_safe: %s", name); + printf("tmpfile: %s", name); - r = writev_safe(fd, iov, 3); - assert(r == 0); + r = writev(fd, iov, 3); + assert(r >= 0); r = read_full_file(name, &contents, &size); assert(r == 0); @@ -640,7 +640,7 @@ int main(int argc, char *argv[]) { test_fstab_node_to_udev_node(); test_get_files_in_directory(); test_in_set(); - test_writev_safe(); + test_writing_tmpfile(); return 0; } |