diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2008-05-22 08:06:58 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2008-05-22 08:06:58 +0000 |
commit | deac652aa663abf85938bc5911cf51b625b4fc6a (patch) | |
tree | de4e971ace74d3371a8de7d2a4e8d71e16c067ca | |
parent | a1f6c4b762b5a10ee6cd7228e082d55578514d5a (diff) |
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.c | 11 | ||||
-rw-r--r-- | usr.sbin/lpr/lpq/lpq.c | 11 |
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); |