Added a fallback implementation of futimes.
This commit is contained in:
parent
ac490fabac
commit
efb8be7e82
|
@ -1064,7 +1064,6 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
|
|||
struct stat st;
|
||||
const FILE_BASIC_INFORMATION *info = ptr;
|
||||
|
||||
#ifdef HAVE_FUTIMES
|
||||
if (info->LastAccessTime.QuadPart || info->LastWriteTime.QuadPart)
|
||||
{
|
||||
ULONGLONG sec, nsec;
|
||||
|
@ -1095,7 +1094,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
|
|||
}
|
||||
if (futimes( fd, tv ) == -1) io->u.Status = FILE_GetNtStatus();
|
||||
}
|
||||
#endif /* HAVE_FUTIMES */
|
||||
|
||||
if (io->u.Status == STATUS_SUCCESS && info->FileAttributes)
|
||||
{
|
||||
if (fstat( fd, &st ) == -1) io->u.Status = FILE_GetNtStatus();
|
||||
|
|
|
@ -282,6 +282,10 @@ extern int getopt_long_only (int ___argc, char *const *___argv,
|
|||
const struct option *__longopts, int *__longind);
|
||||
#endif /* HAVE_GETOPT_LONG */
|
||||
|
||||
#ifndef HAVE_FUTIMES
|
||||
int futimes(int fd, const struct timeval tv[2]);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETPAGESIZE
|
||||
size_t getpagesize(void);
|
||||
#endif /* HAVE_GETPAGESIZE */
|
||||
|
@ -427,6 +431,7 @@ extern long interlocked_xchg_add( long *dest, long incr );
|
|||
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
|
||||
|
||||
#define fstatvfs __WINE_NOT_PORTABLE(fstatvfs)
|
||||
#define futimes __WINE_NOT_PORTABLE(futimes)
|
||||
#define getopt_long __WINE_NOT_PORTABLE(getopt_long)
|
||||
#define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only)
|
||||
#define getpagesize __WINE_NOT_PORTABLE(getpagesize)
|
||||
|
|
|
@ -8,6 +8,7 @@ MODULE = libwine_port.a
|
|||
|
||||
C_SRCS = \
|
||||
fstatvfs.c \
|
||||
futimes.c \
|
||||
getopt.c \
|
||||
getopt1.c \
|
||||
getpagesize.c \
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* futimes function
|
||||
*
|
||||
* Copyright 2004 Alexandre Julliard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#ifndef HAVE_FUTIMES
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <utime.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
int futimes(int fd, const struct timeval tv[2])
|
||||
{
|
||||
#ifdef linux
|
||||
char buffer[sizeof("/proc/self/fd/") + 3*sizeof(int)];
|
||||
|
||||
sprintf( buffer, "/proc/self/fd/%u", fd );
|
||||
if (tv)
|
||||
{
|
||||
struct utimbuf ut;
|
||||
ut.actime = tv[0].tv_sec + (tv[0].tv_usec + 500000) / 1000000;
|
||||
ut.modtime = tv[1].tv_sec + (tv[1].tv_usec + 500000) / 1000000;
|
||||
return utime( buffer, &ut );
|
||||
}
|
||||
else return utime( buffer, NULL );
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* HAVE_FUTIMES */
|
Loading…
Reference in New Issue