From: Ken Coar Date: Wed, 3 May 2000 10:32:45 +0000 (+0000) Subject: Be more expliciti in our error messages if the tmpnam() call fails, X-Git-Tag: APACHE_2_0_ALPHA_4~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9452b0d2a6789f1deacca8041731550fb1c95043;p=thirdparty%2Fapache%2Fhttpd.git Be more expliciti in our error messages if the tmpnam() call fails, or we have trouble opening the filename it returns. PR: Not a solution, but will help debug several git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85129 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/support/htpasswd.c b/support/htpasswd.c index 6dd49b95611..65eb53042d5 100644 --- a/support/htpasswd.c +++ b/support/htpasswd.c @@ -518,9 +518,17 @@ int main(int argc, char *argv[]) * to add or update. Let's do it.. */ tempfilename = tmpnam(NULL); + if ((tempfilename == NULL) || (strlen(tempfilename) == 0)) { + fprintf(stderr, "%s: unable to generate temporary filename\n", + argv[0]); + errno = ENOENT; + perror("tmpnam"); + exit(ERR_FILEPERM); + } ftemp = fopen(tempfilename, "w+"); if (ftemp == NULL) { - fprintf(stderr, "%s: unable to create temporary file\n", argv[0]); + fprintf(stderr, "%s: unable to create temporary file '%s'\n", argv[0], + tempfilename); perror("fopen"); exit(ERR_FILEPERM); }