This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ftell() fails on files in shared folders


On Mar 18 18:55, Yuri Gribov wrote:
> Hi all,
> 
> I have recently ran into a problem with Cygwin accessing files located
> in shared folders. The attached program does fwrite() and then checks
> file size with ftell(). Ftell() returns correct results in any of
> following situations:
> 1) I access local file: c:/test.bin

Wrong style.  Don't use DOS paths.  Use POSIX paths instead, like,
in that case, /cygdrive/c/test.bin.

> 2) I access file via UNC-address from the same computer:
> //server-name/dir/test.out
>   gribov.y@s-cw-head ~/build/upc/opt
>   $ ./a.exe
>   success
> 
> But when I try to access file via UNC-address from a different machine
> ftell() starts returning 0 instead of expected 8:
>   gribov.y@s-cw-head ~/build/upc/opt
>   $ gcc io.c && run_ms_job -n 1 -network smp a.exe
>   ftell(p) == sizeof(data) failed at io.c:26
> 
> Note that the file is created and data is written correctly:
>   gribov.y@s-cw-head ~/build/upc/opt
>   $ xxd ~/pgas/test.bin
>   0000000: ffff ffff ffff ffff                      ........
> so there seem to be a problem with ftell() itself.
> 
> Any help/ideas will be much appreciated. I have tried searching the
> MLs but have not found anything similiar to my problem.

Works for me.  I changed your testcase to allow entering the pathname on
the command line:

  $ ./a ./test.bin
  success
  $ ./a //this-machine/c\$/cygwin/home/corinna/test/bin
  success
  $ ./a //other-machine/c\$/cygwin/home/corinna/test/bin
  success

Either I don't understand your problem description, or you're suffering
from some BLODA problem, maybe.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]