]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfile-util: simplify umask reset declaration
authorLennart Poettering <lennart@poettering.net>
Tue, 30 Apr 2019 07:28:10 +0000 (09:28 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 24 May 2019 13:07:55 +0000 (15:07 +0200)
src/basic/tmpfile-util.c

index e77af7659f00a01e0f9496210fddfbd16e54af75..5100d6a5ff9fc3c6419e1eb96431541fea4734f2 100644 (file)
@@ -58,13 +58,11 @@ int fopen_temporary(const char *path, FILE **_f, char **_temp_path) {
 
 /* This is much like mkostemp() but is subject to umask(). */
 int mkostemp_safe(char *pattern) {
-        _cleanup_umask_ mode_t u = 0;
+        _unused_ _cleanup_umask_ mode_t u = umask(0077);
         int fd;
 
         assert(pattern);
 
-        u = umask(077);
-
         fd = mkostemp(pattern, O_CLOEXEC);
         if (fd < 0)
                 return -errno;