Add helper path_is_absolute()
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 7 Dec 2011 15:50:52 +0000 (13:50 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 7 Dec 2011 15:50:52 +0000 (13:50 -0200)
libkmod/libkmod-private.h
libkmod/libkmod-util.c

index e0cdd55..58ac0db 100644 (file)
@@ -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
index 58ba1d3..477139f 100644 (file)
@@ -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] == '/';
+}