372 |
} |
} |
373 |
#endif |
#endif |
374 |
|
|
375 |
if (stat(filename, &filestatus) >= 0) { |
if (stat(filename, &filestatus) >= 0 && !S_ISDIR(filestatus.st_mode)) { |
376 |
#ifdef AIX |
#ifdef AIX |
377 |
/* if /tmp/foo is not a directory /tmp/foo/ should not exist */ |
/* if /tmp/foo is not a directory /tmp/foo/ should not exist */ |
378 |
if (filename[strlen(filename)-1] == '/' && |
if (filename[strlen(filename)-1] == '/' && |
383 |
} else |
} else |
384 |
if (sSAallow_gzipped_fileA->s.s_dbind != sLnil |
if (sSAallow_gzipped_fileA->s.s_dbind != sLnil |
385 |
&& (strcat(filename,".gz"), |
&& (strcat(filename,".gz"), |
386 |
stat(filename, &filestatus) >= 0)) |
stat(filename, &filestatus) >= 0 && !S_ISDIR(filestatus.st_mode))) |
387 |
return TRUE; |
return TRUE; |
388 |
else |
else |
389 |
return(FALSE); |
return(FALSE); |
390 |
} |
} |
391 |
|
|
392 |
FILE * |
FILE * |
393 |
|
fopen_not_dir(char *filename,char * option) { |
394 |
|
|
395 |
|
struct stat ss; |
396 |
|
|
397 |
|
if (!stat(filename,&ss) && S_ISDIR(ss.st_mode)) |
398 |
|
return NULL; |
399 |
|
else |
400 |
|
return fopen(filename,option); |
401 |
|
|
402 |
|
} |
403 |
|
|
404 |
|
FILE * |
405 |
backup_fopen(char *filename, char *option) |
backup_fopen(char *filename, char *option) |
406 |
{ |
{ |
407 |
char backupfilename[MAXPATHLEN]; |
char backupfilename[MAXPATHLEN]; |
574 |
|
|
575 |
|
|
576 |
coerce_to_local_filename(vs_base[0], filename); |
coerce_to_local_filename(vs_base[0], filename); |
577 |
if (stat(filename, &filestatus) < 0) { vs_base[0] = Cnil; return;} |
if (stat(filename, &filestatus) < 0 || S_ISDIR(filestatus.st_mode)) |
578 |
|
{ vs_base[0] = Cnil; return;} |
579 |
vs_base[0] = unix_time_to_universal_time(filestatus.st_mtime); |
vs_base[0] = unix_time_to_universal_time(filestatus.st_mtime); |
580 |
} |
} |
581 |
|
|
599 |
} |
} |
600 |
|
|
601 |
coerce_to_local_filename(vs_base[0], filename); |
coerce_to_local_filename(vs_base[0], filename); |
602 |
if (stat(filename, &filestatus) < 0) { vs_base[0] = Cnil; return;} |
if (stat(filename, &filestatus) < 0 || S_ISDIR(filestatus.st_mode)) |
603 |
|
{ vs_base[0] = Cnil; return;} |
604 |
pwent = getpwuid(filestatus.st_uid); |
pwent = getpwuid(filestatus.st_uid); |
605 |
vs_base[0] = pwent ? make_simple_string(pwent->pw_name) : Cnil; |
vs_base[0] = pwent ? make_simple_string(pwent->pw_name) : Cnil; |
606 |
#else |
#else |