pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pdf-devel] [PATCH] Add implementation of pdf_fsys_disk_item_p


From: Zac Brown
Subject: Re: [pdf-devel] [PATCH] Add implementation of pdf_fsys_disk_item_p
Date: Mon, 28 Jul 2008 06:52:48 -0700
User-agent: Thunderbird 2.0.0.16 (X11/20080724)

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

Well access should work on the primary systems, so the *BSD's including OS X and Linux as well. Windows AFAIK doesn't really have a concept of a read-only filesystem.

Maybe it would be useful to have some sort of function that will return the state of the filesystem as well by way of statvfs?

-Zac





reply via email to

[Prev in Thread] Current Thread [Next in Thread]