Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
BIND
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
603
Issues
603
List
Boards
Labels
Service Desk
Milestones
Merge Requests
109
Merge Requests
109
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
BIND
Commits
d8ec3078
Commit
d8ec3078
authored
Aug 04, 2001
by
Mark Andrews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
relax safe_create().
parent
ee8a5c01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
bin/rndc/unix/os.c
bin/rndc/unix/os.c
+7
-3
No files found.
bin/rndc/unix/os.c
View file @
d8ec3078
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: os.c,v 1.
1 2001/08/03 05:56:2
2 marka Exp $ */
/* $Id: os.c,v 1.
2 2001/08/04 08:15:0
2 marka Exp $ */
#include <config.h>
...
...
@@ -46,18 +46,22 @@ safe_create(const char *filename) {
int
fd
;
FILE
*
f
;
struct
stat
sb
;
int
flags
=
O_WRONLY
;
if
(
stat
(
filename
,
&
sb
)
==
-
1
)
{
if
(
errno
!=
ENOENT
)
return
(
NULL
);
flags
=
O_WRONLY
|
O_CREAT
|
O_EXCL
;
}
else
if
((
sb
.
st_mode
&
S_IFREG
)
==
0
)
{
errno
=
EOPNOTSUPP
;
return
(
NULL
);
}
}
else
flags
=
O_WRONLY
|
O_TRUNC
;
fd
=
open
(
filename
,
O_WRONLY
|
O_CREAT
|
O_EXCL
,
S_IRUSR
|
S_IWUSR
);
fd
=
open
(
filename
,
flags
,
S_IRUSR
|
S_IWUSR
);
if
(
fd
==
-
1
)
return
(
NULL
);
(
void
)
fchmod
(
fd
,
S_IRUSR
|
S_IWUSR
);
f
=
fdopen
(
fd
,
"w"
);
if
(
f
==
NULL
)
close
(
fd
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment