summarylogtreecommitdiffstats
path: root/unknown_format.patch
blob: 912f057094ce650228bed76c2d1d428d390214ea (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From 7e1e19cdc808e6918c1956de14c90dc5a198b971 Mon Sep 17 00:00:00 2001
From: "sokoloff (Alexander)" <sokoloff.a@gmail.com>
Date: Wed, 16 May 2018 10:55:17 +0300
Subject: [PATCH] Fixed issue #70 "Unknown format of input file" in Manjaro

---
 src/backend/dbus/root/main.cpp | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/backend/dbus/root/main.cpp b/src/backend/dbus/root/main.cpp
index 06d17a9..8ac813f 100644
--- a/src/backend/dbus/root/main.cpp
+++ b/src/backend/dbus/root/main.cpp
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
         return CUPS_BACKEND_FAILED;
     }
 
-    cerr << "DEBUG: [Boomaga root] run boomagabackend as UID:" << pwd->pw_uid << " GID: " << pwd->pw_gid << endl;
+    cerr << "DEBUG: [Boomaga root] run " NONGUI_DIR"/boomagabackend as UID:" << pwd->pw_uid << " GID: " << pwd->pw_gid << endl;
 
     setenv("HOME", pwd->pw_dir, 1);
 
@@ -82,6 +82,19 @@ int main(int argc, char *argv[])
     }
 
 
+    if (argc > 6)
+    {
+        // Read PDF from file
+        stdin = freopen(argv[6], "r", stdin);
+        if (stdin == nullptr)
+        {
+            cerr << "ERROR: [Boomaga root] Can't open input file " << argv[6] << ": ";
+            perror("");
+            return CUPS_BACKEND_FAILED;
+        }
+    }
+
+
     if (setuid(pwd->pw_uid) != 0)
     {
         cerr << "ERROR: [Boomaga root] Can't change UID to " << pwd->pw_uid << ": ";
@@ -90,12 +103,6 @@ int main(int argc, char *argv[])
     }
 
 
-    if (argc > 6)
-    {
-        // Read PDF from file
-        stdin = freopen(argv[6], "r", stdin);
-    }
-
     execl(NONGUI_DIR "/boomagabackend", NONGUI_DIR "/boomagabackend", jobID, title, count, options, NULL);
     perror("ERROR: [Boomaga root] run boomagabackend error");
     return CUPS_BACKEND_FAILED;