diff options
| author | Chloe M. <chloe@faracom.org> | 2026-07-28 06:59:51 +0000 |
|---|---|---|
| committer | Chloe M. <chloe@faracom.org> | 2026-07-28 06:59:51 +0000 |
| commit | 2966b33423ccce1732c4f250229ae7ed18e9e004 (patch) | |
| tree | f6426e032d8e280dfdcf8c5a1b6c98a32592182b /core | |
| parent | 78fc052118815421e574127dd019915c4edcd65e (diff) | |
packer: Strip leading path noise from d_desc
Signed-off-by: Chloe M. <chloe@faracom.org>
Diffstat (limited to 'core')
| -rw-r--r-- | core/rdar.c | 11 |
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; |
