1#include <sys/stat.h>2#include <unistd.h>3#include <utime.h>45#include <time.h>67#include <scc/scc.h>89int10setstat(char *fname, struct fprop *prop)11{12 struct utimbuf ut = {prop->time, prop->time};1314 if (chown(fname, prop->uid, prop->gid) < 0) {15 if (chown(fname, getuid(), getgid()) < 0)16 return -1;17 }18 if (chmod(fname, prop->mode) < 0)19 return -1;20 if (utime(fname, &ut) < 0)21 return -1;22 return 0;23}