]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
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 e0cdd5589fb8174197cf7cd7a9c8545a7287748f..58ac0db1f4bd7368dab8020f8bbe5d056d4e6c3a 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 58ba1d3a498d31f08ba667edd91a81003e07b4dd..477139f5a9a7eb49c82aaf834026f7293e932ea9 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] == '/';
+}