aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-09-24 04:14:43 +0000
committerGuy Harris <guy@alum.mit.edu>1999-09-24 04:14:43 +0000
commit70cd911f619103d329694eb432b2a7ff31222bfd (patch)
tree6c51ce63027e18b97ed9e300fad72c4092b732af /util.c
parent4740872e1f5b7d410b521ec89bf94a458e5de992 (diff)
In "try_tempfile()", if the buffer is too short for the temporary file
name, stuff as much of the name as will fit into the buffer before returning an error, so the error message that gets displayed isn't completely mangled. svn path=/trunk/; revision=716
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/util.c b/util.c
index 1594be061a..66fcd57ba8 100644
--- a/util.c
+++ b/util.c
@@ -1,7 +1,7 @@
/* util.c
* Utility routines
*
- * $Id: util.c,v 1.20 1999/09/23 05:20:18 guy Exp $
+ * $Id: util.c,v 1.21 1999/09/24 04:14:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -213,6 +213,10 @@ try_tempfile(char *namebuf, int namebuflen, const char *dir, const char *pfx)
int tmp_fd;
if (namebuflen < namelen) {
+ /* Stick in a truncated name, so that if this error is
+ reported with the file name, you at least get
+ something. */
+ snprintf(namebuf, namebuflen, "%s%s%s", dir, pfx, suffix);
errno = ENAMETOOLONG;
return -1;
}