Software /
code /
prosody
Comparison
util/prosodyctl/cert.lua @ 13520:662dfff658a0
Merge 0.12->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 30 Aug 2024 18:16:01 +0200 |
parent | 12975:d10957394a3c |
parent | 13518:0ef9c26d9d96 |
comparison
equal
deleted
inserted
replaced
13517:4bf889e94831 | 13520:662dfff658a0 |
---|---|
161 local function copy(from, to, umask, owner, group) | 161 local function copy(from, to, umask, owner, group) |
162 local old_umask = umask and pposix.umask(umask); | 162 local old_umask = umask and pposix.umask(umask); |
163 local attrs = lfs.attributes(to); | 163 local attrs = lfs.attributes(to); |
164 if attrs then -- Move old file out of the way | 164 if attrs then -- Move old file out of the way |
165 local backup = to..".bkp~"..os.date("%FT%T", attrs.change); | 165 local backup = to..".bkp~"..os.date("%FT%T", attrs.change); |
166 os.rename(to, backup); | 166 assert(os.rename(to, backup)); |
167 end | 167 end |
168 -- FIXME friendlier error handling, maybe move above backup back? | 168 -- FIXME friendlier error handling, maybe move above backup back? |
169 local input = assert(io.open(from)); | 169 local input = assert(io.open(from)); |
170 local output = assert(io.open(to, "w")); | 170 local output = assert(io.open(to, "w")); |
171 local data = input:read(2^11); | 171 local data = input:read(2^11); |