summaryrefslogtreecommitdiff
path: root/cpio/test/test_option_u.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@gmail.com>2009-08-04 01:24:31 -0400
committerTim Kientzle <kientzle@gmail.com>2009-08-04 01:24:31 -0400
commitd65fdcd0f7d076126211f15ed23bf3675167ea74 (patch)
tree7ea74d972b0f7c2f9aeef18a4e0599e88429881e /cpio/test/test_option_u.c
parentb9795baa4e1f40b89e7e17f598673f9f7d78d437 (diff)
downloadlibarchive-d65fdcd0f7d076126211f15ed23bf3675167ea74.tar.gz
Convert most open()/read()/write()/close() to use assertMakeFile(), stdio, and slurpfile(), as appropriate.
SVN-Revision: 1337
Diffstat (limited to 'cpio/test/test_option_u.c')
-rw-r--r--cpio/test/test_option_u.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/cpio/test/test_option_u.c b/cpio/test/test_option_u.c
index 7d2edfff..769134cb 100644
--- a/cpio/test/test_option_u.c
+++ b/cpio/test/test_option_u.c
@@ -35,14 +35,10 @@ DEFINE_TEST(test_option_u)
struct utimbuf times;
char *p;
size_t s;
- int fd;
int r;
/* Create a file. */
- fd = open("f", O_CREAT | O_WRONLY, 0644);
- assert(fd >= 0);
- assertEqualInt(1, write(fd, "a", 1));
- close(fd);
+ assertMakeFile("f", 0644, "a");
/* Copy the file to the "copy" dir. */
r = systemf("echo f | %s -pd copy >copy.out 2>copy.err",
@@ -55,10 +51,7 @@ DEFINE_TEST(test_option_u)
assertEqualMem(p, "a", 1);
/* Recreate the file with a single "b" */
- fd = open("f", O_CREAT | O_TRUNC | O_WRONLY, 0644);
- assert(fd >= 0);
- assertEqualInt(1, write(fd, "b", 1));
- close(fd);
+ assertMakeFile("f", 0644, "b");
/* Set the mtime to the distant past. */
memset(&times, 0, sizeof(times));