From: Matthias Kruk Date: Tue, 30 Nov 2021 13:07:29 +0000 (+0900) Subject: include/ipc: Don't dereference symlinks when subscribing to a topic X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=263b60f1a7ff4bfab9557bd35df88115c220408a;p=toolbox include/ipc: Don't dereference symlinks when subscribing to a topic The `_ipc_endpoint_topic_subscribe()' function dereferences symbolic links when subscribing to a topic, causing symbolic links to be created in the wrong directory if the topic already exists. This commit changes the flags that `_ipc_endpoint_topic_subscribe()' passes to `ln' so that the target won't be dereferenced if it refers to a symbolic link. --- diff --git a/include/ipc.sh b/include/ipc.sh index bce6f08..c0b99bc 100644 --- a/include/ipc.sh +++ b/include/ipc.sh @@ -654,7 +654,7 @@ _ipc_endpoint_topic_subscribe() { return 1 fi - if ! ln -sf "$topicdir" "$__ipc_root/$endpoint/subscriptions/$topic"; then + if ! ln -sfn "$topicdir" "$__ipc_root/$endpoint/subscriptions/$topic"; then rm -f "$topicdir/$__ipc_self" return 1 fi