]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fileio: set O_NOCTTY when reading virtual files
authorLennart Poettering <lennart@poettering.net>
Tue, 14 Sep 2021 21:11:55 +0000 (23:11 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 15 Sep 2021 14:19:45 +0000 (16:19 +0200)
Better be safe than sorry, maybe someone points this call to a TTY one
day, and we'd rather not make it our controlling TTY in that case.

src/basic/fileio.c

index af7ae5b1b8f31790ffd9c1f191b1d8f86b85ddd3..efed64cda0f1dfa363b98745f6d1f16c87448c0d 100644 (file)
@@ -395,7 +395,7 @@ int read_virtual_file(const char *filename, size_t max_size, char **ret_contents
          * contents* may be returned. (Though the read is still done using one syscall.) Returns 0 on
          * partial success, 1 if untruncated contents were read. */
 
-        fd = open(filename, O_RDONLY|O_CLOEXEC);
+        fd = open(filename, O_RDONLY|O_NOCTTY|O_CLOEXEC);
         if (fd < 0)
                 return -errno;