aboutsummaryrefslogtreecommitdiff
path: root/www/chromium/files/patch-printing_backend_cups__helper.cc
blob: 6f3d809262b31ce7397c79f048ef68a014bbe7a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- printing/backend/cups_helper.cc.orig	2021-06-10 11:43:23 UTC
+++ printing/backend/cups_helper.cc
@@ -24,7 +24,7 @@
 #include "printing/units.h"
 #include "url/gurl.h"
 
-#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || defined(OS_BSD)
 #include <unistd.h>
 
 #include "base/files/scoped_file.h"
@@ -578,7 +578,7 @@ bool ParsePpdCapabilities(cups_dest_t* dest,
                           base::StringPiece printer_capabilities,
                           PrinterSemanticCapsAndDefaults* printer_info) {
   base::FilePath ppd_file_path;
-#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || defined(OS_BSD)
   // A file created while in a sandbox will be automatically deleted once all
   // handles to it have been closed.  This precludes the use of multiple
   // operations against a file path.
@@ -625,7 +625,7 @@ bool ParsePpdCapabilities(cups_dest_t* dest,
     ppd_status_t ppd_status = ppdLastError(&line);
     LOG(ERROR) << "Failed to open PDD file: error " << ppd_status << " at line "
                << line << ", " << ppdErrorString(ppd_status);
-#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || defined(OS_BSD)
     if (ppd_status != PPD_FILE_OPEN_ERROR) {
       // When the error is not from opening the file then the CUPS library
       // internals will have already closed the file descriptor.  It is
@@ -716,7 +716,7 @@ bool ParsePpdCapabilities(cups_dest_t* dest,
   }
 
   ppdClose(ppd);
-#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || defined(OS_BSD)
   // The CUPS library internals close the file descriptor upon successfully
   // reading it.  Explicitly release the `ScopedFD` to prevent a crash caused
   // by a bad file descriptor.