aboutsummaryrefslogtreecommitdiff
path: root/ubifs-utils/mkfs.ubifs/devtable.c
diff options
context:
space:
mode:
authorDavid Engraf <david.engraf@sysgo.com>2018-03-06 09:13:42 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2018-03-07 14:45:55 +0100
commit80de29a464c7ed639ae337860b5fb346fde8abe5 (patch)
treec8f71dbc12ec3c09acfdff8c08c5121f73a9949e /ubifs-utils/mkfs.ubifs/devtable.c
parent414b71e9f9755e6d49f58eb303abc484115e9048 (diff)
mkfs.ubifs: Allow root entry in device table
When using a local root folder the permissions, user and group settings are taken from the local folder. These permissions might be incorrect if the folder has been created for the local user. Creating an UBIFS image on my local system resulted in the following output on the target: drwx------ 17 1000 1000 1264 Jan 1 00:00 . drwx------ 17 1000 1000 1264 Jan 1 00:00 .. drwxr-xr-x 2 root root 9104 May 30 2017 bin drwxr-xr-x 7 root root 2760 Jan 1 00:00 dev ... mkfs.ubifs aborts with an error message when the device table contains a root entry. This patch allows setting the root folder permissions, user and group to overwrite local configurations. Signed-off-by: David Engraf <david.engraf@sysgo.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils/mkfs.ubifs/devtable.c')
-rw-r--r--ubifs-utils/mkfs.ubifs/devtable.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ubifs-utils/mkfs.ubifs/devtable.c b/ubifs-utils/mkfs.ubifs/devtable.c
index 3b46abc..10faaca 100644
--- a/ubifs-utils/mkfs.ubifs/devtable.c
+++ b/ubifs-utils/mkfs.ubifs/devtable.c
@@ -146,16 +146,16 @@ static int interpret_table_entry(const char *line)
increment, count);
len = strnlen(buf, 1024);
+ if (len == 0)
+ return err_msg("empty path");
if (len == 1024)
return err_msg("too long path");
- if (!strcmp(buf, "/"))
+ if (buf[0] != '/')
return err_msg("device table entries require absolute paths");
- if (buf[1] == '\0')
- return err_msg("root directory cannot be created");
if (strstr(buf, "//"))
return err_msg("'//' cannot be used in the path");
- if (buf[len - 1] == '/')
+ if (len > 1 && buf[len - 1] == '/')
return err_msg("do not put '/' at the end");
if (strstr(buf, "/./") || strstr(buf, "/../") ||