Attachment "file_isdir.patch" to
ticket [99caf06e17]
added by
anonymous
2011-01-11 13:08:58.
Index: src/file.c
===================================================================
--- src/file.c
+++ src/file.c
@@ -111,14 +111,15 @@
*/
int file_isdir(const char *zFilename){
int rc;
if( zFilename ){
- char *zFN = mprintf("%s", zFilename);
- file_simplify_name(zFN, -1);
- rc = getStat(zFN);
- free(zFN);
+ Blob x;
+ blob_zero(&x);
+ file_canonical_name(zFilename, &x);
+ rc = getStat(blob_buffer(&x));
+ blob_reset(&x);
}else{
rc = getStat(0);
}
return rc ? 0 : (S_ISDIR(fileStat.st_mode) ? 1 : 2);
}