eliminate infinite loop with missing tmpdir (Trent Jarvi).
authorjbj <devnull@localhost>
Mon, 14 Sep 1998 18:55:18 +0000 (18:55 +0000)
committerjbj <devnull@localhost>
Mon, 14 Sep 1998 18:55:18 +0000 (18:55 +0000)
CVS patchset: 2310
CVS date: 1998/09/14 18:55:18

CHANGES
lib/misc.c

diff --git a/CHANGES b/CHANGES
index 1322a42..7a278fc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -14,6 +14,7 @@
        - add new fully recursive macro.c
 
 2.5.3 -> 2.5.4:
+       - eliminate infinite loop with missing tmpdir (Trent Jarvi).
        - os_canon for CYGWIN32_NT/95.
        - rationalize autoconf detection of gzip/bzip2.
        - restore backward compatible rpmrc/rpmpopt symlinks.
index a6feb12..4dca9a6 100644 (file)
@@ -326,10 +326,13 @@ int makeTempFile(char * prefix, char ** fnptr, int * fdptr) {
 
     srand(time(NULL));
     ran = rand() % 100000;
+
+     /* maybe this should use link/stat? */
+
     do {
        sprintf(fn, "%s%s/rpm-tmp.%d", prefix, tmpdir, ran++);
        fd = open(fn, O_CREAT | O_RDWR | O_EXCL, 0700);
-    } while (fd < 0);
+    } while (fd < 0 && errno == EEXIST);
 
     if (!stat(fn, &sb) && S_ISLNK(sb.st_mode)) {
        rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fn);