Minor nit - don't append a '/' to tmpdir if it already ends in a '/'.

This commit is contained in:
simonb 1999-10-07 02:05:22 +00:00
parent ed00b4ca01
commit 7d7c6d9f66

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.73 1999/10/05 13:05:42 lukem Exp $ */ /* $NetBSD: util.c,v 1.74 1999/10/07 02:05:22 simonb Exp $ */
/*- /*-
* Copyright (c) 1997-1999 The NetBSD Foundation, Inc. * Copyright (c) 1997-1999 The NetBSD Foundation, Inc.
@ -75,7 +75,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: util.c,v 1.73 1999/10/05 13:05:42 lukem Exp $"); __RCSID("$NetBSD: util.c,v 1.74 1999/10/07 02:05:22 simonb Exp $");
#endif /* not lint */ #endif /* not lint */
/* /*
@ -437,9 +437,10 @@ remglob(argv, doswitch, errbuf)
return (cp); return (cp);
} }
if (ftemp == NULL) { if (ftemp == NULL) {
(void)strlcpy(temp, tmpdir, sizeof(temp)); (void)strlcpy(temp, tmpdir, sizeof(temp));
(void)strlcat(temp, "/", sizeof(temp)); if (temp[strlen(temp) - 1] != '/')
(void)strlcat(temp, TMPFILE, sizeof(temp)); (void)strlcat(temp, "/", sizeof(temp));
(void)strlcat(temp, TMPFILE, sizeof(temp));
if ((fd = mkstemp(temp)) < 0) { if ((fd = mkstemp(temp)) < 0) {
warn("unable to create temporary file %s", temp); warn("unable to create temporary file %s", temp);
return (NULL); return (NULL);