Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/lib/libc/stdio Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/ceca609dc5d8
branches:  netbsd-6
changeset: 776944:ceca609dc5d8
user:      snj <snj%NetBSD.org@localhost>
date:      Thu Apr 16 06:24:16 2015 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1282):
        lib/libc/stdio/gettemp.c: revision 1.16
PR/47757: Eric Radman: mktemp(3) mangles the pathname if not given an absolute
    path
1. on error, gettemp() did not restore the path string
2. when emulating mktemp() it is not an error for the pattern not to represent
   a real directory structure
XXX[1]: pullup-5, pullup-6
XXX[2]: the default pattern is the simplistic <pid><X> for mktemp.

diffstat:

 lib/libc/stdio/gettemp.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r 932f06dd2b03 -r ceca609dc5d8 lib/libc/stdio/gettemp.c
--- a/lib/libc/stdio/gettemp.c  Thu Apr 16 06:20:08 2015 +0000
+++ b/lib/libc/stdio/gettemp.c  Thu Apr 16 06:24:16 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gettemp.c,v 1.14 2008/10/20 10:28:38 apb Exp $ */
+/*     $NetBSD: gettemp.c,v 1.14.22.1 2015/04/16 06:24:16 snj Exp $    */
 
 /*
  * Copyright (c) 1987, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)mktemp.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: gettemp.c,v 1.14 2008/10/20 10:28:38 apb Exp $");
+__RCSID("$NetBSD: gettemp.c,v 1.14.22.1 2015/04/16 06:24:16 snj Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -122,14 +122,16 @@
                if (trv <= path)
                        break;
                if (*trv == '/') {
+                       int e;
                        *trv = '\0';
-                       if (stat(path, &sbuf))
-                               return (0);
+                       e = stat(path, &sbuf);
+                       *trv = '/';
+                       if (e == -1)
+                               return doopen == NULL && !domkdir;
                        if (!S_ISDIR(sbuf.st_mode)) {
                                errno = ENOTDIR;
-                               return (0);
+                               return doopen == NULL && !domkdir;
                        }
-                       *trv = '/';
                        break;
                }
        }



Home | Main Index | Thread Index | Old Index