=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ftp/util.c,v retrieving revision 1.2 retrieving revision 1.3 diff -c -r1.2 -r1.3 *** src/usr.bin/ftp/util.c 1997/02/03 01:05:46 1.2 --- src/usr.bin/ftp/util.c 1997/02/05 04:55:21 1.3 *************** *** 1,4 **** ! /* $OpenBSD: util.c,v 1.2 1997/02/03 01:05:46 millert Exp $ */ /* $NetBSD: util.c,v 1.4 1997/02/01 11:26:34 lukem Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: util.c,v 1.3 1997/02/05 04:55:21 millert Exp $ */ /* $NetBSD: util.c,v 1.4 1997/02/01 11:26:34 lukem Exp $ */ /* *************** *** 35,41 **** */ #ifndef lint ! static char rcsid[] = "$OpenBSD: util.c,v 1.2 1997/02/03 01:05:46 millert Exp $"; #endif /* not lint */ /* --- 35,41 ---- */ #ifndef lint ! static char rcsid[] = "$OpenBSD: util.c,v 1.3 1997/02/05 04:55:21 millert Exp $"; #endif /* not lint */ /* *************** *** 47,54 **** --- 47,56 ---- #include #include + #include #include #include + #include #include #include #include *************** *** 231,240 **** return (cp); } if (ftemp == NULL) { ! (void)snprintf(temp, sizeof(temp), "%s%s", _PATH_TMP, TMPFILE) ; ! fd = mkstemp(temp); ! if (fd < 0) { warn("unable to create temporary file %s", temp); return (NULL); } --- 233,255 ---- return (cp); } if (ftemp == NULL) { ! int len; ! ! if ((cp = getenv("TMPDIR")) == NULL) ! cp = _PATH_TMP; ! len = strlen(cp); ! if (len + sizeof(TMPFILE) + (cp[len-1] != '/') > sizeof(temp)) { ! warnx("unable to create temporary file: %s", ! strerror(ENAMETOOLONG)); ! return (NULL); ! } ! ! (void)strcpy(temp, cp); ! if (temp[len-1] != '/') ! temp[len++] = '/'; ! (void)strcpy(&temp[len], TMPFILE); ; ! if ((fd = mkstemp(temp)) < 0) { warn("unable to create temporary file %s", temp); return (NULL); }