summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2015-08-30 06:50:59 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2015-08-30 06:50:59 +0200
commit090e6baca19f4209a23fb05d9928f51a67c3d5af (patch)
tree44ac2566df9e6a087c5d18720f3b05f702b13e88
parentd63ef2748f18c0f20ea866cb197fa3068f180ec7 (diff)
tst-mkostemps: fix test case on read-only root filesystem
Better use /tmp as embedded systems might have a read-only root. Fix two wrong asserts.
-rw-r--r--test/misc/tst-mkostemps.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/misc/tst-mkostemps.c b/test/misc/tst-mkostemps.c
index 2f45bfd99..272e747a1 100644
--- a/test/misc/tst-mkostemps.c
+++ b/test/misc/tst-mkostemps.c
@@ -33,7 +33,7 @@ main (int argc, char *argv[])
struct stat sb_f2;
/* mkstemp test */
- sprintf(name, "%s-uClibc-test.XXXXXX", __FILE__);
+ sprintf(name, "/tmp/%s-uClibc-test.XXXXXX", __FILE__);
fd = mkstemp(name);
@@ -49,7 +49,7 @@ main (int argc, char *argv[])
unlink (name);
/* mkstemps test */
- sprintf(name_suffix, "%s-uClibc-test.XXXXXX.txt", __FILE__);
+ sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXXX.txt", __FILE__);
fd = mkstemps(name_suffix, 4);
@@ -65,7 +65,7 @@ main (int argc, char *argv[])
unlink (name_suffix);
/* mkostemp test */
- sprintf(name, "%s-uClibc-test.XXXXXX", __FILE__);
+ sprintf(name, "/tmp/%s-uClibc-test.XXXXXX", __FILE__);
fd = mkostemp(name, flags);
@@ -82,14 +82,14 @@ main (int argc, char *argv[])
unlink (name);
/* mkostemps test */
- sprintf(name_suffix, "%s-uClibc-test.XXXXXX.txt", __FILE__);
+ sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXXX.txt", __FILE__);
fd = mkostemps(name_suffix, 4, flags);
fstat(fd, &sb_f1);
assert ((sb_f1.st_mode & S_IFMT) == S_IFREG)
- stat(name, &sb_f2);
+ stat(name_suffix, &sb_f2);
assert ((sb_f2.st_mode & S_IFMT) == S_IFREG)
assert (sb_f1.st_ino == sb_f2.st_ino)
@@ -99,14 +99,14 @@ main (int argc, char *argv[])
unlink (name_suffix);
/* suffixlen = 0 */
- sprintf(name_suffix, "%s-uClibc-test.XXXXXX", __FILE__);
+ sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXXX", __FILE__);
fd = mkostemps(name_suffix, 0, flags);
fstat(fd, &sb_f1);
assert ((sb_f1.st_mode & S_IFMT) == S_IFREG)
- stat(name, &sb_f2);
+ stat(name_suffix, &sb_f2);
assert ((sb_f2.st_mode & S_IFMT) == S_IFREG)
assert (sb_f1.st_ino == sb_f2.st_ino)
@@ -126,7 +126,7 @@ main (int argc, char *argv[])
assert(errno == EINVAL);
/* suffixlen < 0 */
- sprintf(name_suffix, "%s-uClibc-test.XXXXXX.txt", __FILE__);
+ sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXXX.txt", __FILE__);
fd = mkostemps(name_suffix, -1, flags);
@@ -134,7 +134,7 @@ main (int argc, char *argv[])
assert(errno == EINVAL);
/* Missing one X */
- sprintf(name_suffix, "%s-uClibc-test.XXXXX.txt", __FILE__);
+ sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXX.txt", __FILE__);
fd = mkostemps(name_suffix, 4, flags);
@@ -142,7 +142,7 @@ main (int argc, char *argv[])
assert(errno == EINVAL);
/* wrong suffixlen */
- sprintf(name_suffix, "%s-uClibc-test.XXXXXX.txt", __FILE__);
+ sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXXX.txt", __FILE__);
fd = mkostemps(name_suffix, 2, flags);