delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/11/07/02:34:24

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Sun, 6 Nov 2005 23:34:36 -0800
From: Yitzchak Scott-Thoennes <sthoenna AT efn DOT org>
To: cygwin AT cygwin DOT com
Subject: futimes fails on file open for read
Message-ID: <20051107073436.GA7596@efn.org>
Mime-Version: 1.0
User-Agent: Mutt/1.4.2.1i
X-IsSubscribed: yes

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019