* util.c (mc_mkstemps): Don't prepend $TMPDIR if prefix contains
path separator.
Этот коммит содержится в:
родитель
e447c7e10e
Коммит
b4be52ba78
@ -1,3 +1,8 @@
|
|||||||
|
2001-07-27 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* util.c (mc_mkstemps): Don't prepend $TMPDIR if prefix contains
|
||||||
|
path separator.
|
||||||
|
|
||||||
2001-07-26 Pavel Roskin <proski@gnu.org>
|
2001-07-26 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* cmd.c (do_link): Append filename to the default symlink
|
* cmd.c (do_link): Append filename to the default symlink
|
||||||
|
22
src/util.c
22
src/util.c
@ -1316,7 +1316,8 @@ concat_dir_and_file (const char *dir, const char *file)
|
|||||||
* Arguments:
|
* Arguments:
|
||||||
* pname (output) - pointer to the name of the temp file (needs g_free).
|
* pname (output) - pointer to the name of the temp file (needs g_free).
|
||||||
* NULL if the function fails.
|
* NULL if the function fails.
|
||||||
* prefix - part of the filename before the random part (without directory).
|
* prefix - part of the filename before the random part.
|
||||||
|
* Prepend $TMPDIR or /tmp if there are no path separators.
|
||||||
* suffix - if not NULL, part of the filename after the random part.
|
* suffix - if not NULL, part of the filename after the random part.
|
||||||
*
|
*
|
||||||
* Result:
|
* Result:
|
||||||
@ -1328,19 +1329,24 @@ int mc_mkstemps(char **pname, const char *prefix, const char *suffix)
|
|||||||
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
static unsigned long value;
|
static unsigned long value;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
char *tmpdir;
|
|
||||||
char *tmpbase;
|
char *tmpbase;
|
||||||
char *tmpname;
|
char *tmpname;
|
||||||
char *XXXXXX;
|
char *XXXXXX;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
tmpdir = getenv("TMPDIR");
|
if (strchr(prefix, PATH_SEP) == NULL) {
|
||||||
if (!tmpdir) {
|
char *tmpdir;
|
||||||
tmpdir = TMPDIR_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add prefix first to find the position of XXXXXX */
|
tmpdir = getenv("TMPDIR");
|
||||||
tmpbase = concat_dir_and_file (tmpdir, prefix);
|
if (!tmpdir) {
|
||||||
|
tmpdir = TMPDIR_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add prefix first to find the position of XXXXXX */
|
||||||
|
tmpbase = concat_dir_and_file (tmpdir, prefix);
|
||||||
|
} else {
|
||||||
|
tmpbase = g_strdup (prefix);
|
||||||
|
}
|
||||||
|
|
||||||
tmpname = g_strconcat (tmpbase, "XXXXXX", suffix, NULL);
|
tmpname = g_strconcat (tmpbase, "XXXXXX", suffix, NULL);
|
||||||
*pname = tmpname;
|
*pname = tmpname;
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user