Use GLOB_LIMIT. Also fix a bug where gl_offs was not initialized and could

contain trash.
This commit is contained in:
christos 2001-03-16 20:42:12 +00:00
parent b687712e95
commit 62f543d92e
3 changed files with 11 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.38 2001/03/16 20:35:35 lukem Exp $ */
/* $NetBSD: conf.c,v 1.39 2001/03/16 20:42:12 christos Exp $ */
/*-
* Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: conf.c,v 1.38 2001/03/16 20:35:35 lukem Exp $");
__RCSID("$NetBSD: conf.c,v 1.39 2001/03/16 20:42:12 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -596,7 +596,9 @@ show_chdir_messages(int code)
if (EMPTYSTR(curclass.notify))
return;
if (glob(curclass.notify, 0, NULL, &gl) != 0 || gl.gl_matchc == 0)
gl.gl_offs = 0;
if (glob(curclass.notify, GLOB_LIMIT, NULL, &gl) != 0
|| gl.gl_matchc == 0)
return;
time(&now);
for (rlist = gl.gl_pathv; *rlist != NULL; rlist++) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ftpd.c,v 1.121 2001/02/04 22:04:12 christos Exp $ */
/* $NetBSD: ftpd.c,v 1.122 2001/03/16 20:42:13 christos Exp $ */
/*
* Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
@ -109,7 +109,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: ftpd.c,v 1.121 2001/02/04 22:04:12 christos Exp $");
__RCSID("$NetBSD: ftpd.c,v 1.122 2001/03/16 20:42:13 christos Exp $");
#endif
#endif /* not lint */
@ -2641,7 +2641,7 @@ send_file_list(const char *whichf)
p = NULL;
if (strpbrk(whichf, "~{[*?") != NULL) {
int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE;
int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE|GLOB_LIMIT;
memset(&gl, 0, sizeof(gl));
freeglob = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: popen.c,v 1.23 2000/11/30 02:59:11 lukem Exp $ */
/* $NetBSD: popen.c,v 1.24 2001/03/16 20:42:13 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -78,7 +78,7 @@
#if 0
static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
#else
__RCSID("$NetBSD: popen.c,v 1.23 2000/11/30 02:59:11 lukem Exp $");
__RCSID("$NetBSD: popen.c,v 1.24 2001/03/16 20:42:13 christos Exp $");
#endif
#endif /* not lint */
@ -147,7 +147,7 @@ ftpd_popen(char *argv[], const char *type, int stderrfd)
goto pfree;
for (argc = 1; argv[argc]; argc++) {
glob_t gl;
int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE;
int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE|GLOB_LIMIT;
memset(&gl, 0, sizeof(gl));
if (glob(argv[argc], flags, NULL, &gl)) {