version 1.188, 2017/04/27 11:53:12 |
version 1.189, 2017/04/28 03:21:12 |
|
|
#include <pwd.h> |
#include <pwd.h> |
#include <signal.h> |
#include <signal.h> |
#include <stdarg.h> |
#include <stdarg.h> |
|
#include <stdint.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
|
(void) response(); |
(void) response(); |
} |
} |
|
|
|
#define TYPE_OVERFLOW(type, val) \ |
|
((sizeof(type) == 4 && (val) > INT32_MAX) || \ |
|
(sizeof(type) == 8 && (val) > INT64_MAX) || \ |
|
(sizeof(type) != 4 && sizeof(type) != 8)) |
|
|
void |
void |
sink(int argc, char **argv) |
sink(int argc, char **argv) |
{ |
{ |
|
|
#define mtime tv[1] |
#define mtime tv[1] |
#define SCREWUP(str) { why = str; goto screwup; } |
#define SCREWUP(str) { why = str; goto screwup; } |
|
|
|
if (TYPE_OVERFLOW(time_t, 0) || TYPE_OVERFLOW(off_t, 0)) |
|
SCREWUP("Unexpected off_t/time_t size"); |
|
|
setimes = targisdir = 0; |
setimes = targisdir = 0; |
mask = umask(0); |
mask = umask(0); |
if (!pflag) |
if (!pflag) |
|
|
ull = strtoull(cp, &cp, 10); |
ull = strtoull(cp, &cp, 10); |
if (!cp || *cp++ != ' ') |
if (!cp || *cp++ != ' ') |
SCREWUP("mtime.sec not delimited"); |
SCREWUP("mtime.sec not delimited"); |
if ((time_t)ull < 0 || |
if (TYPE_OVERFLOW(time_t, ull)) |
(unsigned long long)(time_t)ull != ull) |
|
setimes = 0; /* out of range */ |
setimes = 0; /* out of range */ |
mtime.tv_sec = ull; |
mtime.tv_sec = ull; |
mtime.tv_usec = strtol(cp, &cp, 10); |
mtime.tv_usec = strtol(cp, &cp, 10); |
|
|
ull = strtoull(cp, &cp, 10); |
ull = strtoull(cp, &cp, 10); |
if (!cp || *cp++ != ' ') |
if (!cp || *cp++ != ' ') |
SCREWUP("atime.sec not delimited"); |
SCREWUP("atime.sec not delimited"); |
if ((time_t)ull < 0 || |
if (TYPE_OVERFLOW(time_t, ull)) |
(unsigned long long)(time_t)ull != ull) |
|
setimes = 0; /* out of range */ |
setimes = 0; /* out of range */ |
atime.tv_sec = ull; |
atime.tv_sec = ull; |
atime.tv_usec = strtol(cp, &cp, 10); |
atime.tv_usec = strtol(cp, &cp, 10); |
|
|
ull = strtoull(cp, &cp, 10); |
ull = strtoull(cp, &cp, 10); |
if (!cp || *cp++ != ' ') |
if (!cp || *cp++ != ' ') |
SCREWUP("size not delimited"); |
SCREWUP("size not delimited"); |
if ((off_t)ull < 0 || (unsigned long long)(off_t)ull != ull) |
if (TYPE_OVERFLOW(off_t, ull)) |
SCREWUP("size out of range"); |
SCREWUP("size out of range"); |
size = (off_t)ull; |
size = (off_t)ull; |
|
|