summaryrefslogtreecommitdiffstats
path: root/src/test/test-stat-util.c
diff options
context:
space:
mode:
authorTopi Miettinen <topimiettinen@users.noreply.github.com>2016-09-13 08:20:38 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2016-09-13 08:20:38 +0200
commit646853bdd8b1337204643aa014ff3f1f49d91a4f (patch)
treeaaeea183f1648a27916dc36f7c0e4468f6039faf /src/test/test-stat-util.c
parentRelicense hwdb/parse_hwdb.py as MIT (#4129) (diff)
downloadsystemd-646853bdd8b1337204643aa014ff3f1f49d91a4f.tar.xz
systemd-646853bdd8b1337204643aa014ff3f1f49d91a4f.zip
fileio: simplify mkostemp_safe() (#4090)
According to its manual page, flags given to mkostemp(3) shouldn't include O_RDWR, O_CREAT or O_EXCL flags as these are always included. Beyond those, the only flag that all callers (except a few tests where it probably doesn't matter) use is O_CLOEXEC, so set that unconditionally.
Diffstat (limited to 'src/test/test-stat-util.c')
-rw-r--r--src/test/test-stat-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/test-stat-util.c b/src/test/test-stat-util.c
index a10227f823..6c34250a01 100644
--- a/src/test/test-stat-util.c
+++ b/src/test/test-stat-util.c
@@ -31,7 +31,7 @@ static void test_files_same(void) {
char name[] = "/tmp/test-files_same.XXXXXX";
char name_alias[] = "/tmp/test-files_same.alias";
- fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+ fd = mkostemp_safe(name);
assert_se(fd >= 0);
assert_se(symlink(name, name_alias) >= 0);
@@ -47,7 +47,7 @@ static void test_is_symlink(void) {
char name_link[] = "/tmp/test-is_symlink.link";
_cleanup_close_ int fd = -1;
- fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+ fd = mkostemp_safe(name);
assert_se(fd >= 0);
assert_se(symlink(name, name_link) >= 0);