This is kind of silly, but building on Android produces a bunch of
warnings like:

lib/readline/histfile.c:626:49: warning: 'open' has superfluous mode bits; 
missing O_CREAT or O_TMPFILE? [-Wuser-defined-warnings]
  626 |   file = open (filename, O_RDONLY|O_BINARY, 0666);
      |                                                 ^

It's not a big deal but it is a bit confusing to see these modes in
the code. Is there some platform where the mode arg is used in this
situation?
---
 builtins/mkbuiltins.c    | 2 +-
 examples/loadables/cat.c | 2 +-
 lib/readline/bind.c      | 4 ++--
 lib/readline/histfile.c  | 4 ++--
 redir.c                  | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/builtins/mkbuiltins.c b/builtins/mkbuiltins.c
index b39b9dd5..2a27826f 100644
--- a/builtins/mkbuiltins.c
+++ b/builtins/mkbuiltins.c
@@ -525,7 +525,7 @@ extract_info (char *filename, FILE *structfile, FILE 
*externfile)
   if (stat (filename, &finfo) == -1)
     file_error (filename);
 
-  fd = open (filename, O_RDONLY, 0666);
+  fd = open (filename, O_RDONLY);
 
   if (fd == -1)
     file_error (filename);
diff --git a/examples/loadables/cat.c b/examples/loadables/cat.c
index 3499755b..a5af4ee0 100644
--- a/examples/loadables/cat.c
+++ b/examples/loadables/cat.c
@@ -84,7 +84,7 @@ cat_main (int argc, char **argv)
                        fd = 0;
                        closefd = 0;
                } else {
-                       fd = open(argv[i], O_RDONLY, 0666);
+                       fd = open(argv[i], O_RDONLY);
                        if (fd < 0) {
                                s = strerror(errno);
                                write(2, "cat: cannot open ", 17);
diff --git a/lib/readline/bind.c b/lib/readline/bind.c
index 6aaa6374..6df53045 100644
--- a/lib/readline/bind.c
+++ b/lib/readline/bind.c
@@ -967,12 +967,12 @@ _rl_read_file (char *filename, size_t *sizep)
   char *buffer;
   int i, file;
 
-  file = open (filename, O_RDONLY, 0666);
+  file = open (filename, O_RDONLY);
   /* If the open is interrupted, retry once */
   if (file < 0 && errno == EINTR)
     {
       RL_CHECK_SIGNALS ();
-      file = open (filename, O_RDONLY, 0666);
+      file = open (filename, O_RDONLY);
     }
   
   if ((file < 0) || (fstat (file, &finfo) < 0))
diff --git a/lib/readline/histfile.c b/lib/readline/histfile.c
index 235243c3..f7539783 100644
--- a/lib/readline/histfile.c
+++ b/lib/readline/histfile.c
@@ -354,7 +354,7 @@ read_history_range (const char *filename, int from, int to)
   if (input == 0)
     return 0;
   errno = 0;
-  file = open (input, O_RDONLY|O_BINARY, 0666);
+  file = open (input, O_RDONLY|O_BINARY);
 
   if ((file < 0) || (fstat (file, &finfo) == -1))
     goto error_and_exit;
@@ -623,7 +623,7 @@ history_truncate_file (const char *fname, int lines)
   if (filename == 0)
     return 0;
   tempname = 0;
-  file = open (filename, O_RDONLY|O_BINARY, 0666);
+  file = open (filename, O_RDONLY|O_BINARY);
   rv = exists = 0;
 
   orig_lines = lines;
diff --git a/redir.c b/redir.c
index 343536b7..0a88b5d4 100644
--- a/redir.c
+++ b/redir.c
@@ -522,7 +522,7 @@ use_tempfile:
   /* In an attempt to avoid races, we close the first fd only after opening
      the second. */
   /* Make the document really temporary.  Also make it the input. */
-  fd2 = open (filename, O_RDONLY|O_BINARY, 0600);
+  fd2 = open (filename, O_RDONLY|O_BINARY);
 
   if (fd2 < 0)
     {
-- 
2.51.0


Reply via email to