- Better handling when settimeofday is not available.
- Adding name translations for p{close,open} and str{,n}casecmp if they exists under other names.
This commit is contained in:
parent
81ecb52cc9
commit
136fae57c3
|
@ -18,6 +18,8 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -319,10 +321,15 @@ BOOL WINAPI SetLocalTime(
|
|||
err = 1;
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
} else {
|
||||
#ifdef HAVE_SETTIMEOFDAY
|
||||
err=settimeofday(&tv, NULL); /* 0 is OK, -1 is error */
|
||||
if(err == 0)
|
||||
return TRUE;
|
||||
SetLastError(ERROR_PRIVILEGE_NOT_HELD);
|
||||
#else
|
||||
err = 1;
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
#endif
|
||||
}
|
||||
ERR("Cannot set time to %d/%d/%d %d:%d:%d Time adjustment %ld %s\n",
|
||||
systime->wYear, systime->wMonth, systime->wDay, systime->wHour,
|
||||
|
@ -407,10 +414,15 @@ BOOL WINAPI SetSystemTime(
|
|||
err = 1;
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
} else {
|
||||
#ifdef HAVE_SETTIMEOFDAY
|
||||
err=settimeofday(&tv, NULL); /* 0 is OK, -1 is error */
|
||||
if(err == 0)
|
||||
return TRUE;
|
||||
SetLastError(ERROR_PRIVILEGE_NOT_HELD);
|
||||
#else
|
||||
err = 1;
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
#endif
|
||||
}
|
||||
ERR("Cannot set time to %d/%d/%d %d:%d:%d Time adjustment %ld %s\n",
|
||||
systime->wYear, systime->wMonth, systime->wDay, systime->wHour,
|
||||
|
|
|
@ -28,9 +28,17 @@
|
|||
#define _GNU_SOURCE /* for pread/pwrite */
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_DIRECT_H
|
||||
# include <direct.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Types */
|
||||
|
||||
|
@ -117,16 +125,16 @@ size_t getpagesize(void);
|
|||
unsigned long inet_network(const char *cp);
|
||||
#endif /* !defined(HAVE_INET_NETWORK) */
|
||||
|
||||
#ifndef HAVE_SETTIMEOFDAY
|
||||
int settimeofday(struct timeval *tp, void *reserved);
|
||||
#endif /* !defined(HAVE_SETTIMEOFDAY) */
|
||||
|
||||
#ifndef HAVE_STATFS
|
||||
int statfs(const char *name, struct statfs *info);
|
||||
#endif /* !defined(HAVE_STATFS) */
|
||||
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
# ifndef HAVE__STRNICMP
|
||||
int strncasecmp(const char *str1, const char *str2, size_t n);
|
||||
# else
|
||||
# define strncasecmp _strnicmp
|
||||
# endif
|
||||
#endif /* !defined(HAVE_STRNCASECMP) */
|
||||
|
||||
#ifndef HAVE_OPENPTY
|
||||
|
@ -140,7 +148,11 @@ const char *strerror(int err);
|
|||
#endif /* !defined(HAVE_STRERROR) */
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
# ifndef HAVE__STRICMP
|
||||
int strcasecmp(const char *str1, const char *str2);
|
||||
# else
|
||||
# define strcasecmp _stricmp
|
||||
# endif
|
||||
#endif /* !defined(HAVE_STRCASECMP) */
|
||||
|
||||
#ifndef HAVE_USLEEP
|
||||
|
@ -151,6 +163,14 @@ int usleep (unsigned int useconds);
|
|||
int lstat(const char *file_name, struct stat *buf);
|
||||
#endif /* HAVE_LSTAT */
|
||||
|
||||
#if !defined(HAVE_POPEN) && defined(HAVE__POPEN)
|
||||
#define popen _popen
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_PCLOSE) && defined(HAVE__PCLOSE)
|
||||
#define pclose _pclose
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PREAD
|
||||
ssize_t pread( int fd, void *buf, size_t count, off_t offset );
|
||||
#endif /* HAVE_PREAD */
|
||||
|
|
|
@ -33,7 +33,9 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#ifdef HAVE_SYS_TIME_h
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
|
@ -332,20 +334,6 @@ unsigned long inet_network(const char *cp)
|
|||
}
|
||||
#endif /* defined(HAVE_INET_NETWORK) */
|
||||
|
||||
/***********************************************************************
|
||||
* settimeofday
|
||||
*/
|
||||
#ifndef HAVE_SETTIMEOFDAY
|
||||
int settimeofday(struct timeval *tp, void *reserved)
|
||||
{
|
||||
tp->tv_sec = 0;
|
||||
tp->tv_usec = 0;
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
#endif /* HAVE_SETTIMEOFDAY */
|
||||
|
||||
/***********************************************************************
|
||||
* statfs
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue