squashfs-tools/0002-Support-creating-sockets-in-unsquashfs.patch
Zhiqiang Liu 6f65f8ac04 squashfs-tools: backport upstream bugfix patches
squashfs-tools: backport upstream bugfix patches

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
2020-07-13 11:46:25 +08:00

68 lines
2.3 KiB
Diff

From 585656b9aeb942c48b810149f976d59c54b9199d Mon Sep 17 00:00:00 2001
From: Kevin Vigor <kvigor@gmail.com>
Date: Mon, 9 Sep 2019 08:55:40 -0700
Subject: [PATCH 2/4] Support creating sockets in unsquashfs.
---
squashfs-tools/unsquashfs.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c
index 727f1d5..aec66c7 100644
--- a/squashfs-tools/unsquashfs.c
+++ b/squashfs-tools/unsquashfs.c
@@ -55,7 +55,7 @@ squashfs_operations *(*read_filesystem_tables)();
struct compressor *comp;
int bytes = 0, swap, file_count = 0, dir_count = 0, sym_count = 0,
- dev_count = 0, fifo_count = 0;
+ dev_count = 0, fifo_count = 0, socket_count = 0;
struct hash_table_entry *inode_table_hash[65536], *directory_table_hash[65536];
int fd;
unsigned int cached_frag = SQUASHFS_INVALID_FRAG;
@@ -1192,7 +1192,14 @@ int create_inode(char *pathname, struct inode *i)
case SQUASHFS_SOCKET_TYPE:
case SQUASHFS_LSOCKET_TYPE:
TRACE("create_inode: socket\n");
- ERROR("create_inode: socket %s ignored\n", pathname);
+
+ if (mknod(pathname, S_IFSOCK | i->mode, 0) == -1) {
+ ERROR("create_inode: failed to create socket %s, "
+ "because %s\n",
+ pathname, strerror(errno));
+ goto failed;
+ }
+ socket_count++;
break;
default:
EXIT_UNSQUASH_STRICT("Unknown inode type %d in create_inode_table!\n",
@@ -2217,7 +2224,7 @@ void *progress_thread(void *arg)
if(progress_enabled) {
pthread_mutex_lock(&screen_mutex);
progress_bar(sym_count + dev_count +
- fifo_count + cur_blocks, total_inodes -
+ fifo_count + socket_count + cur_blocks, total_inodes -
total_files + total_blocks, columns);
pthread_mutex_unlock(&screen_mutex);
}
@@ -2410,7 +2417,7 @@ void disable_progress_bar()
{
pthread_mutex_lock(&screen_mutex);
if(progress_enabled) {
- progress_bar(sym_count + dev_count + fifo_count + cur_blocks,
+ progress_bar(sym_count + dev_count + fifo_count + socket_count + cur_blocks,
total_inodes - total_files + total_blocks, columns);
printf("\n");
}
@@ -2983,6 +2990,7 @@ options:
printf("created %d symlinks\n", sym_count);
printf("created %d devices\n", dev_count);
printf("created %d fifos\n", fifo_count);
+ printf("created %d sockets\n", socket_count);
}
return exit_code;
--
1.8.3.1