chiark / gitweb /
barrier: convert msecs to usecs in test-code
[elogind.git] / src / shared / path-util.c
index e68d3677a7a1b46fa4f7bfb66791f97f0f3dd028..5bc5012fe89ed61900f038dd260d348593ec58fd 100644 (file)
@@ -435,6 +435,22 @@ bool path_equal(const char *a, const char *b) {
         }
 }
 
+char* path_join(const char *root, const char *path, const char *rest) {
+        assert(path);
+
+        if (!isempty(root))
+                return strjoin(root, "/",
+                               path[0] == '/' ? path+1 : path,
+                               rest ? "/" : NULL,
+                               rest && rest[0] == '/' ? rest+1 : rest,
+                               NULL);
+        else
+                return strjoin(path,
+                               rest ? "/" : NULL,
+                               rest && rest[0] == '/' ? rest+1 : rest,
+                               NULL);
+}
+
 int path_is_mount_point(const char *t, bool allow_symlink) {
 
         union file_handle_union h = {
@@ -636,7 +652,7 @@ int fsck_exists(const char *fstype) {
         if (r < 0)
                 return r;
 
-        /* An fsck that is linked to /bin/true is a non-existant
+        /* An fsck that is linked to /bin/true is a non-existent
          * fsck */
 
         r = readlink_malloc(p, &d);