version 1.36, 2015/01/21 03:18:31 |
version 1.37, 2015/01/21 04:08:37 |
|
|
/* |
/* |
* Query. Check to see if file exists. Return one of the following: |
* Query. Check to see if file exists. Return one of the following: |
* |
* |
#ifdef NFS_CHECK |
|
* QC_ONNFS - resides on a NFS |
* QC_ONNFS - resides on a NFS |
#endif NFS_CHECK |
|
#ifdef RO_CHECK |
|
* QC_ONRO - resides on a Read-Only filesystem |
* QC_ONRO - resides on a Read-Only filesystem |
#endif RO_CHECK |
|
* QC_NO - doesn't exist |
* QC_NO - doesn't exist |
* QC_YESsize mtime - exists and its a regular file (size & mtime of file) |
* QC_YESsize mtime - exists and its a regular file (size & mtime of file) |
* QC_YES - exists and its a directory or symbolic link |
* QC_YES - exists and its a directory or symbolic link |
|
|
if (catname && cattarget(name) < 0) |
if (catname && cattarget(name) < 0) |
return; |
return; |
|
|
#if defined(NFS_CHECK) |
|
if (IS_ON(options, DO_CHKNFS)) { |
if (IS_ON(options, DO_CHKNFS)) { |
s = is_nfs_mounted(target, &stb, &stbvalid); |
s = is_nfs_mounted(target, &stb, &stbvalid); |
if (s > 0) |
if (s > 0) |
|
|
return; |
return; |
} |
} |
} |
} |
#endif /* NFS_CHECK */ |
|
|
|
#if defined(RO_CHECK) |
|
if (IS_ON(options, DO_CHKREADONLY)) { |
if (IS_ON(options, DO_CHKREADONLY)) { |
s = is_ro_mounted(target, &stb, &stbvalid); |
s = is_ro_mounted(target, &stb, &stbvalid); |
if (s > 0) |
if (s > 0) |
|
|
return; |
return; |
} |
} |
} |
} |
#endif /* RO_CHECK */ |
|
|
|
if (IS_ON(options, DO_CHKSYM)) { |
if (IS_ON(options, DO_CHKSYM)) { |
if (is_symlinked(target, &stb, &stbvalid) > 0) { |
if (is_symlinked(target, &stb, &stbvalid) > 0) { |
|
|
} |
} |
|
|
/* |
/* |
* If stbvalid is false, "stb" is not valid because: |
* If stbvalid is false, "stb" is not valid because the stat() |
* a) RO_CHECK and NFS_CHECK were not defined |
* by is_*_mounted() either failed or does not match "target". |
* b) The stat by is_*_mounted() either failed or |
|
* does not match "target". |
|
*/ |
*/ |
if (!stbvalid && lstat(target, &stb) < 0) { |
if (!stbvalid && lstat(target, &stb) < 0) { |
if (errno == ENOENT) |
if (errno == ENOENT) |