X-Git-Url: http://www.wagner.pp.ru/gitweb/?p=oss%2Fcatdoc.git;a=blobdiff_plain;f=src%2Ffileutil.c;h=86139ecdb833e332679d5ec03078b7198319713c;hp=657b02252375cf2a9caa7c7b1bccd801c28767a3;hb=69e68e6b8d2f38a4c5b896ebd42eb1d866b2087d;hpb=1202f84b0b3c0f7cf474fea44129ce736a3123f1 diff --git a/src/fileutil.c b/src/fileutil.c index 657b022..86139ec 100644 --- a/src/fileutil.c +++ b/src/fileutil.c @@ -104,10 +104,14 @@ int check_charset(char **filename,const char *charset) { return 1; } tmppath=find_file(stradd(charset,CHARSET_EXT),charset_path); - if (tmppath&& *tmppath) { - *filename=strdup(charset); - free(tmppath); - return 1; + /* Some compilers evalate both arguments of && before + applying, so let's not use && as in the shell */ + if (tmppath) { + if (*tmppath) { + *filename=strdup(charset); + free(tmppath); + return 1; + } } return 0; } @@ -176,14 +180,16 @@ void list_charsets(void) { char *q; char path_buf[PATH_BUF_SIZE]; char dir_sep[2]={DIR_SEP,0}; + char **ptr; #ifdef __MSDOS__ struct ffblk ffblock; int res,col; #else glob_t glob_buf; int count,glob_flags=GLOB_ERR; + + memset(&glob_buf,0,sizeof(glob_t)); #endif - char **ptr; for (p=charset_path;p;p=(q?(q+1):NULL)) { q=strchr(p,LIST_SEP); if (q) {