X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fclean-temp.c;h=1053312ecb1845b37a42dacd470bb24432fc081f;hb=931b01b091932a1f796c23379ea32abb68bd5895;hp=0ac9fa04ef9756335e93df733d12d13d3661e1c1;hpb=7be93f2d05131d061bd4790ae33c8d50f50010d7;p=platform%2Fupstream%2Fm4.git diff --git a/lib/clean-temp.c b/lib/clean-temp.c index 0ac9fa0..1053312 100644 --- a/lib/clean-temp.c +++ b/lib/clean-temp.c @@ -1,5 +1,5 @@ /* Temporary directories and temporary files with automatic cleanup. - Copyright (C) 2001, 2003, 2006-2007, 2009-2011 Free Software Foundation, + Copyright (C) 2001, 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2006. @@ -59,13 +59,10 @@ #define _(str) gettext (str) -/* GNU Hurd doesn't have PATH_MAX. */ +/* GNU Hurd doesn't have PATH_MAX. Use a fallback. + Temporary directory names are usually not that long. */ #ifndef PATH_MAX -# ifdef MAXPATHLEN -# define PATH_MAX MAXPATHLEN -# else -# define PATH_MAX 1024 -# endif +# define PATH_MAX 1024 #endif #ifndef uintptr_t @@ -559,7 +556,10 @@ cleanup_temp_dir (struct temp_dir *dir) } else cleanup_list.tempdir_list[i] = NULL; - /* Now only we can free the tmpdir->dirname and tmpdir itself. */ + /* Now only we can free the tmpdir->dirname, tmpdir->subdirs, + tmpdir->files, and tmpdir itself. */ + gl_list_free (tmpdir->files); + gl_list_free (tmpdir->subdirs); free (tmpdir->dirname); free (tmpdir); return err; @@ -582,10 +582,18 @@ static bool supports_delete_on_close () { static int known; /* 1 = yes, -1 = no, 0 = unknown */ + /* M4 wants to close and later reopen a temporary file, so + delete-on-close must not be used. */ + known = -1; if (!known) { OSVERSIONINFO v; + /* According to + + this structure must be initialised as follows: */ + v.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); + if (GetVersionEx (&v)) known = (v.dwPlatformId == VER_PLATFORM_WIN32_NT ? 1 : -1); else