Skip to content
Snippets Groups Projects
Commit 84460f79 authored by Andreas Dilger's avatar Andreas Dilger
Browse files

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.
parent 523937fe
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment