[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][ftp-team/dak][master] 2 commits: Open lock files read-only and create if not exist



Title: GitLab

Joerg Jaspert pushed to branch master at Debian FTP Team / dak

Commits:

1 changed file:

Changes:

  • config/debian/cronscript
    ... ... @@ -223,9 +223,18 @@ function lock() {
    223 223
             LOCKFILE=${!lvar}
    
    224 224
         fi
    
    225 225
     
    
    226
    +    # bash can't open a file read-only, while creating it,
    
    227
    +    # so we need to create it ourselves.
    
    228
    +    if ! [[ -e $LOCKFILE ]]; then
    
    229
    +        install -m 444 /dev/null $LOCKFILE || {
    
    230
    +            log_error "Could not create lock ${LOCKFILE}"
    
    231
    +            laststeps 2
    
    232
    +        }
    
    233
    +    fi
    
    234
    +
    
    226 235
         # Get filehandle
    
    227 236
         local randomstring
    
    228
    -    exec {randomstring}<>${LOCKFILE}
    
    237
    +    exec {randomstring}<${LOCKFILE}
    
    229 238
         # Store filehandle for later
    
    230 239
         LOCKFD[${LOCK}]=${randomstring}
    
    231 240
     
    


  • Reply to: