diff options
author | Gerald Combs <gerald@wireshark.org> | 2003-11-03 02:41:07 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2003-11-03 02:41:07 +0000 |
commit | 5903ff03a3b12afa7cb90e27b09137237bf82ebe (patch) | |
tree | 7e30ebf0e72f546286ea8ab72403ff9b1bfe818a /epan/filesystem.c | |
parent | cb452773c29a7b1c5683af4a6608f5103f4871b3 (diff) |
Make get_tempfile_path() work like get_datafile_path(), which removes
a dependency on PATH_MAX (which apparently isn't defined under Windows).
svn path=/trunk/; revision=8862
Diffstat (limited to 'epan/filesystem.c')
-rw-r--r-- | epan/filesystem.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/epan/filesystem.c b/epan/filesystem.c index 9857cb1316..521ddb54ba 100644 --- a/epan/filesystem.c +++ b/epan/filesystem.c @@ -1,7 +1,7 @@ /* filesystem.c * Filesystem utility routines * - * $Id: filesystem.c,v 1.25 2003/11/02 23:12:34 gerald Exp $ + * $Id: filesystem.c,v 1.26 2003/11/03 02:41:07 gerald Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -632,9 +632,9 @@ deletefile(const char *path) * Construct and return the path name of a file in the * $TMP/%TEMP% directory. */ -char *get_tempfile_path(const char *file) +char *get_tempfile_path(const char *filename) { - char path [PATH_MAX], *dir, *def; + char *path, *dir, *def; #ifdef WIN32 dir = getenv("TEMP"); @@ -644,9 +644,11 @@ char *get_tempfile_path(const char *file) def = "/tmp"; #endif if (!dir || (dir = get_dirname(dir)) == NULL) - return g_strdup(def); + dir = def; - snprintf(path, sizeof(path), "%s%c%s", dir, G_DIR_SEPARATOR, file); - return g_strdup(path); + path = (gchar *) g_malloc(strlen(dir) + strlen(filename) + 2); + sprintf(path, "%s" G_DIR_SEPARATOR_S "%s", dir, filename); + + return path; } |