Aleksander Morgado wrote:
Hello Zac.
Attached is the merge directive for pdf_fsys_disk_item_p.
+ file = fopen ((char*)ascii_path, "r");
+ if (file == NULL)
+ {
+ goto error_cleanup;
+ }
Note that such a call to fopen will fail if the file is not readable,
but still exists in the filesystem. Also, it will work for directories
in POSIX systems but, will it work in windows systems?
This function should also work for files for which the client doesnt
have read perms.
Yep, I missed this mail. That's my point in my previous mail.
I would suggest to use 'stat' or 'lstat' to do this (those functions
has support for directories, special files, etc). AFAIK mingw has
support for the stat function and anyway we have the sys_stat.h
portability file from gnulib already installed in libgnupdf.
stat gives you the permission bits, but we should also consider the way
the filesystem was mounted (read-only filesystems can happen). access()
is the good way to do it, but don't know if it's portable or not.
-Aleksander
My current thought is to implement *item_p, *writable_p, and *readable_p on top
of *get_item_props. Seeing as using stat+access is already what I'm doing in
*get_item_props.
For Win32 there's no need to use fstat/access (which are questionably effective)
when we can use FindFirstFile. FindFirstFile will return a data structure that
has all the information that stat+access would provide.
Anyone have a problem with this?
-Zac