coreutils

General Software Utilities
git clone http://git.omkov.net/coreutils
Log | Tree | Refs | README | LICENCE | Download

AuthorJamozed <[email protected]>
Date2020-07-09 10:03:19
Commitee5817c1ee64348f64c3849a8edba07ddd06820d
Parentfb217a800bdc58afe584f69935f74c60eb4bd5df

touch: Fix implicit conversion warning

Diffstat

M src/touch.c | 6 +++---

1 files changed, 3 insertions, 3 deletions

diff --git a/src/touch.c b/src/touch.c
index 3d3a36e..8e3590f 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -1,4 +1,4 @@
-// touch.c, version 1.0.1
+// touch.c, version 1.0.2
 // OMKOV coreutils implementation of POSIX touch
 // Copyright (C) 2020, Jakob Wakeling
 // All rights reserved.
@@ -147,8 +147,8 @@ static inline void rparse(const char *file) {
 static inline int touch(const char *file) {
 	if (utimensat(AT_FDCWD, file, times, 0)) {
 		if (errno != ENOENT) { return 1; } if (cflag) { return 0; }
-		int mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
-		register int fd; if ((fd = creat(file, mode)) == -1) { return 1; }
+		unsigned m = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+		register int fd; if ((fd = creat(file, m)) == -1) { return 1; }
 		if (futimens(fd, times)) { close(fd); return 1; } close(fd);
 	} return 0;
 }