(O_NOCTTY): Define if not defined already.
authorJim Meyering <jim@meyering.net>
Sun, 30 Apr 2000 21:48:23 +0000 (21:48 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 30 Apr 2000 21:48:23 +0000 (21:48 +0000)
(touch): Add O_NOCTTY to the flags passed to open.

src/touch.c

index 09f5c7cc6de9929a3d1f8a4c923bb2bf002060b7..5045790af9b421052ff021d804d2618a62c803f0 100644 (file)
@@ -52,6 +52,10 @@ time_t time ();
 # define O_NONBLOCK O_NDELAY
 #endif
 
+#if !defined O_NOCTTY
+# define O_NOCTTY 0
+#endif
+
 /* The name by which this program was run. */
 char *program_name;
 
@@ -131,7 +135,7 @@ touch (const char *file)
   if (! no_create)
     {
       /* Try to open FILE, creating it if necessary.  */
-      fd = open (file, O_WRONLY | O_CREAT | O_NONBLOCK,
+      fd = open (file, O_WRONLY | O_CREAT | O_NONBLOCK | O_NOCTTY,
                 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
       if (fd == -1)
        open_errno = errno;