117 const int AMode = S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH;
118 char local_path[MAXPATHLEN+1], *p, pc;
119 local_path[0] =
'\0';
120 unsigned long long remotefs;
121 int isLink = 0, Missing = 1, retc = 0, datfd;
131 if ((retc =
GenLocalPath(path, local_path)))
return retc;
135 if ((Missing = lstat(local_path, &buf))) retc = errno;
136 else {
if ((isLink = ((buf.st_mode & S_IFMT) == S_IFLNK)))
137 {
if (
stat(local_path, &buf))
138 {
if (errno != ENOENT)
return -errno;
139 OssEroute.Emsg(
"Create",
"removing dangling link",local_path);
140 if (
unlink(local_path)) retc = errno;
141 Missing = 1; isLink = 0;
145 if (retc && retc != ENOENT)
return -retc;
152 access_mode, crInfo.
pOpts);
159 if ((buf.st_mode & S_IFMT) == S_IFDIR)
return -EISDIR;
160 do {datfd =
open(local_path, Opts>>8, access_mode);}
161 while(datfd < 0 && errno == EINTR);
162 if (datfd < 0)
return -errno;
163 if ((retc =
SetFattr(crInfo, datfd, buf.st_mtime)))
return retc;
164 if (Opts>>8 & O_TRUNC && buf.st_size)
165 {off_t theSize = buf.st_size;
166 if (isLink) {buf.st_mode = (buf.st_mode & ~S_IFMT) | S_IFLNK;
176 {p++; pc = *p; *p =
'\0';
184 {
char remote_path[MAXPATHLEN+1];
193 {
if ((retc =
MSS_Create(remote_path, access_mode, env)) < 0)
195 <<
" remote path=" <<remote_path);
199 {
if (!(retc =
MSS_Stat(remote_path)))
return -EEXIST;
200 else if (retc != -ENOENT)
return retc;
static int a2sz(XrdSysError &, const char *emsg, const char *item, long long *val, long long minv=-1, long long maxv=-1)