]> andersk Git - openssh.git/commitdiff
- (bal) utimes() support via utime() interface on machine that lack utimes().
authormouring <mouring>
Mon, 15 Jan 2001 02:34:37 +0000 (02:34 +0000)
committermouring <mouring>
Mon, 15 Jan 2001 02:34:37 +0000 (02:34 +0000)
ChangeLog
acconfig.h
bsd-misc.c
bsd-misc.h
configure.in
includes.h

index 56da470b934b6d7ccd7d41ae8318da9c228b5875..481a1332195dbd0e77f909d978a68938acaaf166 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 20010115
  - (bal) sftp-server.c change to use chmod() if fchmod() does not exist.
+ - (bal) utimes() support via utime() interface on machine that lack utimes().
 
 20010114
  - (stevesk) initial work for OpenBSD "support supplementary group in
index 6f56deb0a394b20e06130fbe09473ea58fd1d502..e2c34317d7c11ed98ad6b3c274afe95a8bbf7f4b 100644 (file)
  * message at run-time. */
 #undef RSAREF
 
+/* struct timeval */
+#undef HAVE_STRUCT_TIMEVAL
+
 /* struct utmp and struct utmpx fields */
 #undef HAVE_HOST_IN_UTMP
 #undef HAVE_HOST_IN_UTMPX
index 2a0596593c5afd770184e965b212966ad78fd89f..2e59019bc588325d3c2db21d9712291057b3ede7 100644 (file)
@@ -80,3 +80,15 @@ const char *strerror(int e)
                return(sys_errlist[e]);
 }
 #endif
+
+#ifndef HAVE_UTIMES
+int utimes(char *filename, struct timeval *tvp)
+{
+       struct utimbuf ub;
+
+       ub.actime = tvp->tv_sec;
+       ub.modtime = tvp->tv_usec;
+       
+       return(utime(filename, &ub));
+}
+#endif 
index d8376562adc6e25c55f7b38276b8bfbb37467ee2..e02c6678335f0ad53efd59091ed74bd4008583d4 100644 (file)
@@ -54,4 +54,17 @@ int seteuid(uid_t euid);
 const char *strerror(int e);
 #endif 
 
+
+#ifndef HAVE_UTIMES
+#ifndef HAVE_STRUCT_TIMEVAL
+struct timeval {
+       long tv_sec;
+       long tv_usec;
+}
+#endif /* HAVE_STRUCT_TIMEVAL */
+
+int utimes(char *filename, struct timeval *tvp);
+#endif /* HAVE_UTIMES */
+
+
 #endif /* _BSD_MISC_H */
index 1ee1885658566266288655d7526b84116ef205da..82cb5d4bd12f96f0014becaa42d33ae90c647183 100644 (file)
@@ -313,10 +313,10 @@ AC_CHECK_FUNC(utimes,
 )
 
 # Checks for header files.
-AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/queue.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h vis.h)
+AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/queue.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stddef.h time.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
 
 dnl    Checks for library functions.
-AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv seteuid setlogin setproctitle setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strsep strtok_r sysconf vsnprintf vhangup vis waitpid _getpty __b64_ntop)
+AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv seteuid setlogin setproctitle setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strsep strtok_r sysconf utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop)
 dnl    Checks for time functions
 AC_CHECK_FUNCS(gettimeofday time)
 dnl    Checks for libutil functions
@@ -825,14 +825,27 @@ if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
        AC_DEFINE(HAVE_STRUCT_ADDRINFO)
 fi
 
+AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
+       AC_TRY_COMPILE(
+               [ #include <sys/time.h> ], 
+               [ struct timeval tv; tv.tv_sec = 1;], 
+               [ ac_cv_have_struct_timeval="yes" ],
+               [ ac_cv_have_struct_timeval="no" ]
+       )
+])
+if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
+       AC_DEFINE(HAVE_STRUCT_TIMEVAL)
+       have_struct_timeval=1
+fi
+
 # If we don't have int64_t then we can't compile sftp-server.  So don't
 # even attempt to do it. 
 if test "x$ac_cv_have_int64_t" = "xno" -a \
        "x$ac_cv_sizeof_long_int" != "x8" -a \
        "x$ac_cv_sizeof_long_long_int" = "x0" ; then
        NO_SFTP='#'
-       AC_SUBST(NO_SFTP)
 fi
+AC_SUBST(NO_SFTP)
 
 dnl Checks for structure members
 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
index 96e97ca591c7a37a78c11c99b486ec4b596a7fd8..fc269e8ebed6850b7892f81866c53c0fa0aa5e29 100644 (file)
@@ -85,6 +85,9 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
 #ifdef HAVE_SYS_SYSMACROS_H
 # include <sys/sysmacros.h>
 #endif
+#ifdef HAVE_UTIME_H
+# include <utime.h>
+#endif
 #ifdef HAVE_VIS_H
 # include <vis.h>
 #endif
This page took 0.147716 seconds and 5 git commands to generate.