File: utimes.c

package info (click to toggle)
zlibc 0.9k-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 616 kB
  • ctags: 461
  • sloc: ansic: 3,073; sh: 2,947; csh: 128; makefile: 57; sed: 4
file content (44 lines) | stat: -rw-r--r-- 807 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * utimes.c
 *
 * Copyright (C) 1993 Alain Knaff
 */
#define _LARGEFILE64_SOURCE
#define _GNU_SOURCE

#include "sysincludes.h"


#ifdef SYS_UTIMES

int utimes(__const char *file_name, struct timeval *buf)
{
  int st;
  char newname[MAXPATHLEN + MAXEXTLEN + 1];

  _zlibc_init();
  st=zlib_real_utimes(file_name, buf);

  if ( st >= 0 || errno != ENOENT )
    return st;

  zlib_initialise();
  if ( zlib_mode & CM_DISAB )
    return st;
  if ( (zlib_getfiletype(file_name,-1) & PM_READ_MASK) == PM_LEAVE_COMPR)
    return st;
  
  if ( zlib_mode & CM_VERBOSE )
    fprintf(stderr,"Utiming %s\n",file_name);
  
  strncpy(newname,file_name,1024);
  strcat(newname,zlib_ext);
  
  errno = 0;
  st=zlib_real_utimes(newname, buf);
  if ( st < 0 && errno == EINVAL )
    errno = ENOENT;
  return st;
}

#endif