diff options
author | Guy Harris <guy@alum.mit.edu> | 1999-09-24 04:14:43 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 1999-09-24 04:14:43 +0000 |
commit | 70cd911f619103d329694eb432b2a7ff31222bfd (patch) | |
tree | 6c51ce63027e18b97ed9e300fad72c4092b732af /util.c | |
parent | 4740872e1f5b7d410b521ec89bf94a458e5de992 (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.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; } |