delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/09/08/09:13:00

Sender: ml AT delorie DOT com
Message-ID: <3413F91D.5B73A3AE@cdata.tvnet.hu>
Date: Mon, 08 Sep 1997 15:09:49 +0200
From: Molnar Laszlo <molnarl AT cdata DOT tvnet DOT hu>
MIME-Version: 1.0
To: DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: problem with glob()

Hi Workers!

If I try this:

struct glob_t pglob;
glob ("noNeSuch.xx*",0,0,&pglob);
globfree (&pglob);

I will get a SIGSEGV. This is because pglob is not touched in glob() as
the docs says. However I looked at another glob() implementation, and it
cleared the struct like in the patch. I think we should use this too.

Laszlo

*** glob.c~     Sun Aug 31 11:32:32 1997
--- glob.c      Sun Sep  7 23:34:44 1997
***************
*** 355,358 ****
--- 355,365 ----
    slash = '/';
  
+   if (!(_flags & GLOB_APPEND)) 
+     {
+       _pglob->gl_pathc = 0;
+       _pglob->gl_pathv = NULL;
+       if (!(flags & GLOB_DOOFFS))
+         _pglob->gl_offs = 0;
+     }
    if (glob2(_pattern, pathbuf, preserve_case ? 0 : 1, preserve_case ?
0 : 1) == GLOB_NOSPACE)
      {

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019