mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
util_path: add function to check if a path exists
GitHub-ID: #20 Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com> Acked-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This commit is contained in:
committed by
Michael Holzheu
parent
283e0bd5ea
commit
df133846b5
@@ -194,3 +194,15 @@ free_str:
|
||||
free(path);
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool util_path_exists(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *path;
|
||||
bool rc;
|
||||
|
||||
UTIL_VASPRINTF(&path, fmt, ap);
|
||||
rc = access(path, F_OK) == 0;
|
||||
free(path);
|
||||
return rc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user