From 6ce1e2d8af3015b20ed89fe4f4a5c96e19644e2c Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sat, 19 Nov 2022 19:49:41 +0900 Subject: [PATCH] include/queue: Create data file when queue is created The data file that contains the queue data is not created when a queue is created, but rather when data is inserted into the queue. This causes issues in applications that use queues to share between users because they need so set permissions on the entire queue at the time of initialization. However, because the data file is not created at that time, its permissions cannot be set. This commit modifies `queue_init()' so that the data file is created together with the queue. --- include/queue.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/queue.sh b/include/queue.sh index 0aed18d..f396689 100644 --- a/include/queue.sh +++ b/include/queue.sh @@ -142,15 +142,18 @@ queue_init() { local path local sem + local data path=$(_queue_get_path "$queue") sem=$(_queue_get_sem "$queue") + data=$(_queue_get_data "$queue") if ! mkdir "$path" &> /dev/null; then return 1 fi - if ! sem_init "$sem" 0; then + if ! sem_init "$sem" 0 || + ! touch "$data"; then rmdir "$path" &> /dev/null return 1 fi -- 2.47.3