mirror of
https://github.com/rkd77/elinks.git
synced 2024-10-03 03:56:32 -04:00
Revert
http://cvsweb.elinks.cz/cvsweb.cgi/elinks/src/util/file.c.diff?r1=1.44;r2=1.45 patch, which has to be reworked, without modifying file_exists().
This commit is contained in:
parent
84523875b3
commit
2a71adda10
@ -46,7 +46,7 @@
|
||||
#include "util/file.h"
|
||||
#include "util/memory.h"
|
||||
#include "util/string.h"
|
||||
#include "protocol/uri.h"
|
||||
|
||||
|
||||
/* Not that these two would be so useful for portability (they are ANSI C) but
|
||||
* they encapsulate the lowlevel stuff (need for <unistd.h>) nicely. */
|
||||
@ -54,29 +54,12 @@
|
||||
int
|
||||
file_exists(const unsigned char *filename)
|
||||
{
|
||||
int result;
|
||||
unsigned char *decoded_filename;
|
||||
#ifdef HAVE_ACCESS
|
||||
|
||||
result = access(filename, F_OK);
|
||||
if (result >= 0) return 1;
|
||||
decoded_filename = stracpy((unsigned char *)filename);
|
||||
if (!decoded_filename) return 0;
|
||||
decode_uri(decoded_filename);
|
||||
result = access(decoded_filename, F_OK);
|
||||
mem_free(decoded_filename);
|
||||
return result >= 0;
|
||||
return access(filename, F_OK) >= 0;
|
||||
#else
|
||||
struct stat buf;
|
||||
|
||||
result = stat(filename, &buf);
|
||||
if (result >= 0) return 1;
|
||||
decoded_filename = stracpy((unsigned char *)filename);
|
||||
if (!decoded_filename) return 0;
|
||||
decode_uri(decoded_filename);
|
||||
result = stat(decoded_filename, &buf);
|
||||
mem_free(decoded_filename);
|
||||
return result >= 0;
|
||||
return stat(filename, &buf) >= 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user