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]

futimes fails on file open for read


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/


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