From 84460f79bade1f41cb8081af9d194c24e616e59c Mon Sep 17 00:00:00 2001
From: adilger <adilger>
Date: Thu, 12 Feb 2004 18:19:54 +0000
Subject: [PATCH] Don't pass garbage mode bits to the filesystem with O_CREAT.
 It is really the fault of K&R that there are 2 different open prototypes.

---
 lustre/tests/openfile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lustre/tests/openfile.c b/lustre/tests/openfile.c
index 81236b085a..d494b4a4fe 100644
--- a/lustre/tests/openfile.c
+++ b/lustre/tests/openfile.c
@@ -53,7 +53,7 @@ int main(int argc, char** argv)
 {
         int    fd;
         int    flags=0;
-        mode_t mode=0;
+        mode_t mode=0644;
         char*  fname=NULL;
         int    mode_set=0;
         int    flag_set=0;
@@ -131,7 +131,7 @@ int main(int argc, char** argv)
         }
 
 
-        if (mode_set)
+        if (flags & O_CREAT)
                 fd = open(fname, flags, mode);
         else
                 fd = open(fname, flags);
-- 
GitLab