Possible glob() problem ?

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

On an Atmel NGW100 dev kit (atngw100-base_defconfig), I appear to have a slight problem with glob().

Can someone else confirm the following code ?

Create an empty file /etc/avahi/services/ssh.service. Then run the code.

Both glob() calls work (globret = 0).

If you delete the line "errno = 0;", then the second glob() fails (globret = 2).

Regards
Mark

#include 
#include 
#include 
#include 

int main(void) {
   glob_t globbuf;
   int globret;
   memset(&globbuf, 0, sizeof(globbuf));

   globret = glob("/etc/avahi/services/*.service", GLOB_ERR, NULL, &globbuf);
   printf("test globret = %d\n", globret);
   globfree(&globbuf);

   unlink("/tmp/missing_file");

   errno = 0;
   memset(&globbuf, 0, sizeof(globbuf));
   globret = glob("/etc/avahi/services/*.service", GLOB_ERR, NULL, &globbuf);
   printf("test globret = %d\n", globret);
   globfree(&globbuf);
}
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fixed.

It would appear that I needed to enable the extra uClibc setting UCLIBC_HAS_GNU_GLOB