aboutsummaryrefslogtreecommitdiff
path: root/ubifs-utils
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-04-03 12:54:16 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-04-03 15:31:39 +0200
commit2a26da4468197884d1381bffafe9161453863505 (patch)
tree1bba1024b58c296076ffaa2af8b389d897732dd0 /ubifs-utils
parentb5027be5f470830ac9543db3c52e076b13abd313 (diff)
mkfs.ubifs: fix regression when trying to store device special files
Commit a767dd30 added a check to add_inode that bails when trying to store extra data in anything other than a symlink. The symlink encryption support added by that commit relies on the assumption. Unfortionately it was overlooked that device special files also store the device number as additional data in the inode. The check added in commit a767dd30 broke support for device files in mkfs.ubifs. This commit adds a quick and dirty fix, moving the check into the fscrypt branch, breaking only the fscrypt version but restoring old functionality for unencrypted file systems. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils')
-rw-r--r--ubifs-utils/mkfs.ubifs/mkfs.ubifs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
index e0c42f3..4b31979 100644
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
@@ -1531,12 +1531,13 @@ static int add_inode(struct stat *st, ino_t inum, void *data,
ino->flags = cpu_to_le32(use_flags);
ino->compr_type = cpu_to_le16(c->default_compr);
if (data_len) {
- if (!S_ISLNK(st->st_mode))
- return err_msg("Expected symlink");
-
if (!fctx) {
memcpy(&ino->data, data, data_len);
} else {
+ /* TODO: what about device files? */
+ if (!S_ISLNK(st->st_mode))
+ return err_msg("Expected symlink");
+
ret = encrypt_symlink(&ino->data, data, data_len, fctx);
if (ret < 0)
return ret;