]> git.corax.cc Git - toolbox/commitdiff
include/queue: Correctly handle omitted timeout in queue_get_file()
authorMatthias Kruk <m@m10k.eu>
Wed, 30 Jun 2021 22:36:10 +0000 (07:36 +0900)
committerMatthias Kruk <m@m10k.eu>
Wed, 30 Jun 2021 22:36:10 +0000 (07:36 +0900)
The queue_get_file() function does not correctly interpret the timeout
as infinity if the parameter is omitted.
This commit adds a check to queue_get_file() so that the timeout is
set correctly if the parameter is omitted.

include/queue.sh

index f4c36e3314bff8b9ce524d6525b51de4af2740e3..4bef0fae2add688c5ef32d03672d584272034018 100644 (file)
@@ -430,6 +430,10 @@ queue_get_file() {
        local dest
        local err
 
+       if (( $# < 3 )); then
+               timeout=-1
+       fi
+
        if ! [ -d "$destdir" ]; then
                log_error "Destination must be a directory"
                return 1