futimes fails on file open for read

Yitzchak Scott-Thoennes sthoenna@efn.org
Mon Nov 7 08:39:00 GMT 2005


The following gives:

futimes returned: -1 (Permission denied)

I'm told it succeeds on linux; is it even possible for it to work on
cygwin or am I SOL?

#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>

int main(int argc,char **argv)
{
   int fd, ret;
   struct timeval tv[2] = {{500000000, 0}, {500000000, 0}}; 

   if (system("touch foo") == -1) return 1;
   if ((fd = open("foo", O_RDONLY)) == -1) return 1;
   errno = 0;
   ret = futimes(fd, tv);
   printf("futimes returned: %d (%s)\n", ret, strerror(errno));
   return 0;
}

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



More information about the Cygwin mailing list