]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
No longer use O_RDWR for append mode (Issue #291)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 4 May 2022 12:10:46 +0000 (08:10 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 4 May 2022 12:10:46 +0000 (08:10 -0400)
CHANGES.md
cups/file.c

index 3d325ca560128e17d9b860798eac3a5f5c2cdd88..050c41116a52a40ea1d3cc35cb4e82ca6f4ff97f 100644 (file)
@@ -4,6 +4,8 @@ CHANGES - OpenPrinting CUPS 2.4.1 - 2022-01-27
 Changes in CUPS v2.4.2 (TBA)
 ----------------------------
 
+- The `cupsFileOpen` function no longer opens files for append in read-write
+  mode (Issue #291)
 - The cupsd daemon removed processing temporary queue (Issue #364)
 - Fixed delay in IPP backend if GNUTLS is used and endpoint doesn't confirm
   closing the connection (Issue #365)
index 14683fa020ebe0b8a5083bfd1e2c8d97f04cbb67..48969e64aa98eb2b8ac4978a35e0c7c3ca35423b 100644 (file)
@@ -6,7 +6,7 @@
  * our own file functions allows us to provide transparent support of
  * different line endings, gzip'd print files, PPD files, etc.
  *
- * Copyright © 2021 by OpenPrinting.
+ * Copyright © 2021-2022 by OpenPrinting.
  * Copyright © 2007-2019 by Apple Inc.
  * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
  *
@@ -1100,8 +1100,7 @@ cupsFileOpen(const char *filename,        /* I - Name of file */
   switch (*mode)
   {
     case 'a' : /* Append file */
-        fd = cups_open(filename,
-                      O_RDWR | O_CREAT | O_APPEND | O_LARGEFILE | O_BINARY);
+        fd = cups_open(filename, O_WRONLY | O_CREAT | O_APPEND | O_LARGEFILE | O_BINARY);
         break;
 
     case 'r' : /* Read file */
@@ -1112,8 +1111,7 @@ cupsFileOpen(const char *filename,        /* I - Name of file */
         fd = cups_open(filename, O_WRONLY | O_LARGEFILE | O_BINARY);
        if (fd < 0 && errno == ENOENT)
        {
-         fd = cups_open(filename,
-                        O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE | O_BINARY);
+         fd = cups_open(filename, O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE | O_BINARY);
          if (fd < 0 && errno == EEXIST)
            fd = cups_open(filename, O_WRONLY | O_LARGEFILE | O_BINARY);
        }