Add helper path_is_absolute()
This commit is contained in:
parent
a5cce6d6ef
commit
3a468809b8
|
@ -116,6 +116,7 @@ ssize_t read_str_safe(int fd, char *buf, size_t buflen) __must_check __attribute
|
|||
int read_str_long(int fd, long *value, int base) __must_check __attribute__((nonnull(2)));
|
||||
int read_str_ulong(int fd, unsigned long *value, int base) __must_check __attribute__((nonnull(2)));
|
||||
char *strchr_replace(char *s, int c, char r);
|
||||
bool path_is_absolute(const char *p) __must_check __attribute__((nonnull(1)));
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -214,3 +214,10 @@ char *strchr_replace(char *s, int c, char r)
|
|||
|
||||
return s;
|
||||
}
|
||||
|
||||
bool path_is_absolute(const char *p)
|
||||
{
|
||||
assert(p != NULL);
|
||||
|
||||
return p[0] == '/';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue