xref: /illumos-gate/usr/src/lib/libresolv2/common/bsd/utimes.c (revision 628e3cbed6489fa1db545d8524a06cd6535af456)
1 /*
2  * Copyright (c) 1997-2000 by Sun Microsystems, Inc.
3  * All rights reserved.
4  */
5 
6 /*
7  * Copyright (c) 1997,1999 by Internet Software Consortium.
8  *
9  * Permission to use, copy, modify, and distribute this software for any
10  * purpose with or without fee is hereby granted, provided that the above
11  * copyright notice and this permission notice appear in all copies.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
14  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
15  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
16  * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
17  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
18  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
19  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20  * SOFTWARE.
21  */
22 
23 
24 #pragma ident	"%Z%%M%	%I%	%E% SMI"
25 
26 #include "port_before.h"
27 
28 #include <sys/types.h>
29 #include <sys/time.h>
30 #include <utime.h>
31 
32 #include "port_after.h"
33 
34 #ifndef NEED_UTIMES
35 int __bind_utimes_unneeded;
36 #else
37 
38 int
39 __utimes(char *filename, struct timeval *tvp) {
40 	struct utimbuf utb;
41 
42 	utb.actime = (time_t)tvp[0].tv_sec;
43 	utb.modtime = (time_t)tvp[1].tv_sec;
44 	return (utime(filename, &utb));
45 }
46 
47 #endif /* NEED_UTIMES */
48