summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2008-05-22 08:06:57 +0000
committerotto <otto@openbsd.org>2008-05-22 08:06:57 +0000
commit371748eded8db95d9fad08a173e11f6372e3ef7f (patch)
treedc75a873b581623421ad080549cc292f618d821f
parentfix updating to tags pointing at branch revisions; (diff)
downloadwireguard-openbsd-371748eded8db95d9fad08a173e11f6372e3ef7f.tar.xz
wireguard-openbsd-371748eded8db95d9fad08a173e11f6372e3ef7f.zip
Comparing string literals does not work as the author expected.
From Adam Majer (debian maintaner); looks correct fgs@
-rw-r--r--usr.sbin/lpr/lpd/lpd.c11
-rw-r--r--usr.sbin/lpr/lpq/lpq.c11
2 files changed, 14 insertions, 8 deletions
diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c
index cbe84139a91..61669e223b3 100644
--- a/usr.sbin/lpr/lpd/lpd.c
+++ b/usr.sbin/lpr/lpd/lpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpd.c,v 1.47 2007/09/02 15:19:38 deraadt Exp $ */
+/* $OpenBSD: lpd.c,v 1.48 2008/05/22 08:06:57 otto Exp $ */
/* $NetBSD: lpd.c,v 1.33 2002/01/21 14:42:29 wiz Exp $ */
/*
@@ -41,7 +41,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)lpd.c 8.7 (Berkeley) 5/10/95";
#else
-static const char rcsid[] = "$OpenBSD: lpd.c,v 1.47 2007/09/02 15:19:38 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: lpd.c,v 1.48 2008/05/22 08:06:57 otto Exp $";
#endif
#endif /* not lint */
@@ -650,11 +650,14 @@ ckqueue(char *cap)
struct dirent *d;
DIR *dirp;
char *spooldir;
+ int free_spooldir = 1;
- if (cgetstr(cap, "sd", &spooldir) == -1)
+ if (cgetstr(cap, "sd", &spooldir) == -1) {
spooldir = _PATH_DEFSPOOL;
+ free_spooldir = 0;
+ }
dirp = opendir(spooldir);
- if (spooldir != _PATH_DEFSPOOL)
+ if (free_spooldir)
free(spooldir);
if (dirp == NULL)
return (-1);
diff --git a/usr.sbin/lpr/lpq/lpq.c b/usr.sbin/lpr/lpq/lpq.c
index c94787af3f0..8df943c8597 100644
--- a/usr.sbin/lpr/lpq/lpq.c
+++ b/usr.sbin/lpr/lpq/lpq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpq.c,v 1.16 2007/02/16 13:29:04 jmc Exp $ */
+/* $OpenBSD: lpq.c,v 1.17 2008/05/22 08:06:57 otto Exp $ */
/* $NetBSD: lpq.c,v 1.9 1999/12/07 14:54:47 mrg Exp $ */
/*
@@ -41,7 +41,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)lpq.c 8.3 (Berkeley) 5/10/95";
#else
-static const char rcsid[] = "$OpenBSD: lpq.c,v 1.16 2007/02/16 13:29:04 jmc Exp $";
+static const char rcsid[] = "$OpenBSD: lpq.c,v 1.17 2008/05/22 08:06:57 otto Exp $";
#endif
#endif /* not lint */
@@ -168,11 +168,14 @@ ckqueue(char *cap)
struct dirent *d;
DIR *dirp;
char *spooldir;
+ int free_spooldir = 1;
- if (cgetstr(cap, "sd", &spooldir) == -1)
+ if (cgetstr(cap, "sd", &spooldir) == -1) {
spooldir = _PATH_DEFSPOOL;
+ free_spooldir = 0;
+ }
dirp = opendir(spooldir);
- if (spooldir != _PATH_DEFSPOOL)
+ if (free_spooldir)
free(spooldir);
if (dirp == NULL)
return (-1);