annotate lib/creat-safer.c @ 6130:44d5f5bdd253

GNU tar needs these.
author Jim Meyering <jim@meyering.net>
date Sat, 27 Aug 2005 14:27:24 +0000
parents
children 96c32553b4c6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6130
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
1 /* Invoke creat, but avoid some glitches.
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
2 Copyright (C) 2005 Free Software Foundation, Inc.
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
3
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
6 the Free Software Foundation; either version 2, or (at your option)
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
7 any later version.
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
8
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
12 GNU General Public License for more details.
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
13
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
15 along with this program; if not, write to the Free Software Foundation,
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
17
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
18 /* Written by Jim Meyering. */
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
19
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
20 #if HAVE_CONFIG_H
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
21 # include <config.h>
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
22 #endif
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
23
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
24 #include "fcntl-safer.h"
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
25
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
26 #include <fcntl.h>
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
27 #include "unistd-safer.h"
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
28
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
29 int
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
30 creat_safer (char const *file, mode_t mode)
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
31 {
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
32 return fd_safer (creat (file, mode));
44d5f5bdd253 GNU tar needs these.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
33 }