vol: open() needs mode if called with O_CREAT
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Fri, 11 Jun 2010 23:23:22 +0000 (00:23 +0100)
committerDerrick Brashear <shadow@dementia.org>
Sun, 13 Jun 2010 05:40:13 +0000 (22:40 -0700)
commite35e0b732db1132de4b5f9af050cf6939792ef8e
tree1852201a312c57d330d4075202c31188f2c5bd3f
parentc880fe7740864daca59b93d35055c1973d9382a9
vol: open() needs mode if called with O_CREAT

If open() is called with a the O_CREAT flag, then it requires a
3rd argument, containing the mode with which to create the file.
On DARWIN (when we always use O_CREAT), and on other platforms
where the first call to open returned E_NOENT, we weren't doing this,
and so were presumably getting a random mode of whatever garbage was
on the stack.

Caught by clang-analyzer

Change-Id: Ic173e582e0d46f6d4cf8801dc7a6b4b393db5063
Reviewed-on: http://gerrit.openafs.org/2139
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/vol/partition.c