summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/rdar.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/rdar.c b/core/rdar.c
index 2f7cea8..4482f02 100644
--- a/core/rdar.c
+++ b/core/rdar.c
@@ -208,6 +208,7 @@ idata_from_file(const char *path, bool is_root)
struct idata_desc *idata_desc;
struct data_desc *data_desc;
size_t path_len;
+ const char *p;
path_len = strlen(path);
if (path_len >= RDAR_MAX_PATHLEN - 1) {
@@ -229,10 +230,18 @@ idata_from_file(const char *path, bool is_root)
}
}
+ p = path;
+
+ /* Strip leading path stuff */
+ while (*p == '.' && *p != '\0')
+ ++p;
+ while (*p == '/' && *p != '\0')
+ ++p;
+
/* Initialize the data descriptor */
data_desc = &idata_desc->data;
memcpy(data_desc->magic, RDAR_MAGIC, RDAR_MAGIC_LEN);
- memcpy(data_desc->path, path, path_len);
+ memcpy(data_desc->path, p, strlen(p));
data_desc->path[path_len] = '\0';
data_desc->flags = 0;
data_desc->off = 0;