Mercurial > hg > octave-shane > gnulib-hg
annotate lib/mkdtemp.c @ 15727:144db791c6fa
Ensure EBADF returns for socket functions on mingw.
* lib/accept.c (rpl_accept): Fail with error EBADF if the file
descriptor is invalid.
* lib/bind.c (rpl_bind): Likewise.
* lib/connect.c (rpl_connect): Likewise.
* lib/getpeername.c (rpl_getpeername): Likewise.
* lib/getsockname.c (rpl_getsockname): Likewise.
* lib/getsockopt.c (rpl_getsockopt): Likewise.
* lib/listen.c (rpl_listen): Likewise.
* lib/recv.c (rpl_recv): Likewise.
* lib/recvfrom.c (rpl_recvfrom): Likewise.
* lib/send.c (rpl_send): Likewise.
* lib/sendto.c (rpl_sendto): Likewise.
* lib/setsockopt.c (rpl_setsockopt): Likewise.
* lib/shutdown.c (rpl_shutdown): Likewise.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Wed, 21 Sep 2011 00:20:59 +0200 |
parents | 97fc9a21a8fb |
children | 8250f2777afc |
rev | line source |
---|---|
14079
97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents:
12559
diff
changeset
|
1 /* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2011 Free Software |
12559
c2cbabec01dd
update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents:
12313
diff
changeset
|
2 Foundation, Inc. |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 This file is part of the GNU C Library. |
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8192
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify |
4440
e58a1c05a6ba
Update gettext source files from gettext automatically, using srclist-update.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4237
diff
changeset
|
6 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8192
diff
changeset
|
7 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8192
diff
changeset
|
8 (at your option) any later version. |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 |
4440
e58a1c05a6ba
Update gettext source files from gettext automatically, using srclist-update.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4237
diff
changeset
|
10 This program is distributed in the hope that it will be useful, |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
4440
e58a1c05a6ba
Update gettext source files from gettext automatically, using srclist-update.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4237
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e58a1c05a6ba
Update gettext source files from gettext automatically, using srclist-update.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4237
diff
changeset
|
13 GNU General Public License for more details. |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8192
diff
changeset
|
15 You should have received a copy of the GNU General Public License |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8192
diff
changeset
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 |
7588
66be60b7a727
* modules/tmpdir (Depends-on): Add sys_stat.
Eric Blake <ebb9@byu.net>
parents:
7342
diff
changeset
|
18 /* Extracted from misc/mkdtemp.c. */ |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 |
7304
1c4ed7637c24
Include <config.h> unconditionally.
Bruno Haible <bruno@clisp.org>
parents:
7293
diff
changeset
|
20 #include <config.h> |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 |
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 /* Specification. */ |
8192
b9003c1ee8fa
mkdtemp.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
7588
diff
changeset
|
23 #include <stdlib.h> |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 |
7588
66be60b7a727
* modules/tmpdir (Depends-on): Add sys_stat.
Eric Blake <ebb9@byu.net>
parents:
7342
diff
changeset
|
25 #include "tempname.h" |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 |
12313
17f04ebac8e3
mkstemp: avoid conflict with C++ keyword template
Eric Blake <ebb9@byu.net>
parents:
12233
diff
changeset
|
27 /* Generate a unique temporary directory from XTEMPLATE. |
17f04ebac8e3
mkstemp: avoid conflict with C++ keyword template
Eric Blake <ebb9@byu.net>
parents:
12233
diff
changeset
|
28 The last six characters of XTEMPLATE must be "XXXXXX"; |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 they are replaced with a string that makes the filename unique. |
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 The directory is created, mode 700, and its name is returned. |
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 (This function comes from OpenBSD.) */ |
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 char * |
12313
17f04ebac8e3
mkstemp: avoid conflict with C++ keyword template
Eric Blake <ebb9@byu.net>
parents:
12233
diff
changeset
|
33 mkdtemp (char *xtemplate) |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 { |
12313
17f04ebac8e3
mkstemp: avoid conflict with C++ keyword template
Eric Blake <ebb9@byu.net>
parents:
12233
diff
changeset
|
35 if (gen_tempname (xtemplate, 0, 0, GT_DIR)) |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 return NULL; |
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 else |
12313
17f04ebac8e3
mkstemp: avoid conflict with C++ keyword template
Eric Blake <ebb9@byu.net>
parents:
12233
diff
changeset
|
38 return xtemplate; |
4237
723deab1223e
mkdtemp() function: create a private temporary directory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 } |