This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] gcc cannot deal with full /tmp
- From: Ian Lance Taylor <iant at google dot com>
- To: Denys Vlasenko <dvlasenk at redhat dot com>
- Cc: dj at redhat dot com, ian at airs dot com, gcc-patches at gcc dot gnu dot org, binutils at sources dot redhat dot com
- Date: Tue, 29 Jul 2008 07:23:21 -0700
- Subject: Re: [PATCH] gcc cannot deal with full /tmp
- References: <200807281911.00146.dvlasenk@redhat.com>
Denys Vlasenko <dvlasenk@redhat.com> writes:
> @@ -166,12 +167,13 @@ make_temp_file (const char *suffix)
> strcpy (temp_filename + base_len + TEMP_FILE_LEN, suffix);
>
> fd = mkstemps (temp_filename, suffix_len);
> - /* If mkstemps failed, then something bad is happening. Maybe we should
> - issue a message about a possible security attack in progress? */
> + /* mkstemps failed. It may be EPERM, ENOSPC etc. */
> if (fd == -1)
> - abort ();
> - /* Similarly if we can not close the file. */
> + {
> + fprintf(stderr, "Cannot create temporary file in %s: %s\n", base, strerror(errno));
> + abort ();
> + }
> if (close (fd))
> - abort ();
> + abort (); /* sheer paranoia */
> return temp_filename;
> }
make_temp_file is documented as returning NULL on failure. Would it
be reasonable to simply return NULL for certain errno codes?
As far as the patch goes:
* Comments should be complete sentences.
* The fprintf line is too long--it needs to wrap at 80 columns.
* Don't put a comment on the same line as abort ().
Otherwise this seems good. How did you test it?
Ian