1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

(confucius_mktmpdir): Changed to use mkdtmp(3).

This commit is contained in:
Werner Koch 2005-04-11 17:22:23 +00:00
parent 3441826da7
commit 14f6a82ca9
2 changed files with 11 additions and 22 deletions

View File

@ -1,3 +1,7 @@
2005-04-11 Werner Koch <wk@g10code.com>
* symcryptrun.c (confucius_mktmpdir): Changed to use mkdtmp(3).
2005-04-11 Marcus Brinkmann <marcus@g10code.de>
* symcryptrun.c: Implement config file parsing.

View File

@ -227,32 +227,17 @@ i18n_init(void)
static char *
confucius_mktmpdir (void)
{
int res;
char *tmpdir;
char *name;
tmpdir = tmpnam (NULL);
if (!tmpdir)
name = strdup ("/tmp/gpg-XXXXXX");
if (!name || !mkdtemp (name))
{
log_error (_("cannot create temporary directory name: %s\n"),
strerror (errno));
return NULL;
}
tmpdir = strdup (tmpdir);
if (!tmpdir)
{
log_error (_("cannot copy temporary directory name: %s\n"),
strerror (errno));
return NULL;
}
res = mkdir (tmpdir, 0700);
if (res < 0)
{
log_error (_("cannot create temporary directory %s: %s\n"),
tmpdir, strerror (errno));
log_error (_("can't create temporary directory `%s': %s\n"),
name?name:"", strerror (errno));
return NULL;
}
return tmpdir;
return name;
}
@ -702,7 +687,7 @@ confucius_main (int mode)
tmpdir = confucius_mktmpdir ();
if (!tmpdir)
return 1;
/* TMPDIR + "/" + "in" + "\0". */
infile = malloc (strlen (tmpdir) + 1 + 2 + 1);
if (!infile)