ftell() fails on files in shared folders

Yuri Gribov tetra2005@googlemail.com
Sun Mar 18 14:55:00 GMT 2012


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
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.

-Yuri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 22672 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20120318/8ee17b96/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: io.c
Type: text/x-csrc
Size: 787 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20120318/8ee17b96/attachment.bin>
-------------- next part --------------
--
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


More information about the Cygwin mailing list