Possible glob() problem ?

Mark Jackson mpfj at mimc.co.uk
Thu Jul 24 14:28:06 UTC 2008


Using buildroot cvs 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 ?

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

Regards
Mark

#include <stdio.h>
#include <glob.h>
#include <errno.h>
#include <string.h>

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);
}



More information about the uClibc mailing list