refactor(fileio.c): make unreadable expression readable

This commit is contained in:
Lewis Russell
2023-01-31 10:04:44 +00:00
parent eacdece354
commit 33a183e898

View File

@@ -3090,14 +3090,12 @@ nobackup:
// quotum for number of files). // quotum for number of files).
// Appending will fail if the file does not exist and forceit is // Appending will fail if the file does not exist and forceit is
// false. // false.
while ((fd = os_open(wfname, const int fflags = O_WRONLY | (append
O_WRONLY | ? (forceit ? (O_APPEND | O_CREAT) : O_APPEND)
(append : (O_CREAT | O_TRUNC));
? (forceit const int mode = perm < 0 ? 0666 : (perm & 0777);
? (O_APPEND | O_CREAT)
: O_APPEND) while ((fd = os_open(wfname, fflags, mode)) < 0) {
: (O_CREAT | O_TRUNC)),
perm < 0 ? 0666 : (perm & 0777))) < 0) {
// A forced write will try to create a new file if the old one // A forced write will try to create a new file if the old one
// is still readonly. This may also happen when the directory // is still readonly. This may also happen when the directory
// is read-only. In that case the mch_remove() will fail. // is read-only. In that case the mch_remove() will fail.