374 |
} |
} |
375 |
#endif |
#endif |
376 |
|
|
377 |
if (stat(filename, &filestatus) >= 0) |
if (stat(filename, &filestatus) >= 0 && !S_ISDIR(filestatus.st_mode)) |
378 |
{ |
{ |
379 |
#ifdef AIX |
#ifdef AIX |
380 |
/* if /tmp/foo is not a directory /tmp/foo/ should not exist */ |
/* if /tmp/foo is not a directory /tmp/foo/ should not exist */ |
388 |
else |
else |
389 |
if (sSAallow_gzipped_fileA->s.s_dbind != sLnil |
if (sSAallow_gzipped_fileA->s.s_dbind != sLnil |
390 |
&& (strcat(filename,".gz"), |
&& (strcat(filename,".gz"), |
391 |
stat(filename, &filestatus) >= 0)) |
stat(filename, &filestatus) >= 0 && !S_ISDIR(filestatus.st_mode))) |
392 |
|
|
393 |
return TRUE; |
return TRUE; |
394 |
|
|
397 |
} |
} |
398 |
|
|
399 |
FILE * |
FILE * |
400 |
|
fopen_not_dir(char *filename,char * option) { |
401 |
|
|
402 |
|
struct stat ss; |
403 |
|
|
404 |
|
if (!stat(filename,&ss) && S_ISDIR(ss.st_mode)) |
405 |
|
return NULL; |
406 |
|
else |
407 |
|
return fopen(filename,option); |
408 |
|
|
409 |
|
} |
410 |
|
|
411 |
|
FILE * |
412 |
backup_fopen(char *filename, char *option) |
backup_fopen(char *filename, char *option) |
413 |
{ |
{ |
414 |
char backupfilename[MAXPATHLEN]; |
char backupfilename[MAXPATHLEN]; |
527 |
check_arg(1); |
check_arg(1); |
528 |
check_type_or_pathname_string_symbol_stream(&vs_base[0]); |
check_type_or_pathname_string_symbol_stream(&vs_base[0]); |
529 |
coerce_to_filename(vs_base[0], filename); |
coerce_to_filename(vs_base[0], filename); |
530 |
if (stat(filename, &filestatus) < 0) { vs_base[0] = Cnil; return;} |
if (stat(filename, &filestatus) < 0 || S_ISDIR(filestatus.st_mode)) |
531 |
|
{ vs_base[0] = Cnil; return;} |
532 |
vs_base[0] = unix_time_to_universal_time(filestatus.st_mtime); |
vs_base[0] = unix_time_to_universal_time(filestatus.st_mtime); |
533 |
} |
} |
534 |
|
|
545 |
check_arg(1); |
check_arg(1); |
546 |
check_type_or_pathname_string_symbol_stream(&vs_base[0]); |
check_type_or_pathname_string_symbol_stream(&vs_base[0]); |
547 |
coerce_to_filename(vs_base[0], filename); |
coerce_to_filename(vs_base[0], filename); |
548 |
if (stat(filename, &filestatus) < 0) { vs_base[0] = Cnil; return;} |
if (stat(filename, &filestatus) < 0 || S_ISDIR(filestatus.st_mode)) |
549 |
|
{ vs_base[0] = Cnil; return;} |
550 |
pwent = getpwuid(filestatus.st_uid); |
pwent = getpwuid(filestatus.st_uid); |
551 |
vs_base[0] = make_simple_string(pwent->pw_name); |
vs_base[0] = make_simple_string(pwent->pw_name); |
552 |
#else |
#else |