File: qepcad-B-tty.patch

package info (click to toggle)
qepcad 1.74%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 4,848 kB
  • sloc: ansic: 27,242; cpp: 2,995; makefile: 1,287; perl: 91
file content (51 lines) | stat: -rw-r--r-- 1,629 bytes parent folder | download | duplicates (2)
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
Description: Tell Singular not to steal the TTY 
Origin: https://src.fedoraproject.org/rpms/qepcad-B/blob/91dd25b/f/qepcad-B-tty.patch
Bug: https://bugzilla.redhat.com/1257471
Forwarded: https://github.com/chriswestbrown/qepcad/pull/2
Last-Update: 2021-06-23

--- a/source/db/SINGULAR.c
+++ b/source/db/SINGULAR.c
@@ -1,6 +1,7 @@
 #include "SINGULAR.h"
 #include <iostream>
 #include <string>
+#include <unistd.h>
 using namespace std;
 
 
@@ -15,6 +16,12 @@
   if (childpid == 0) {
     intoSingular.setStdinToPipe();
     outofSingular.setStdoutToPipe();
+    outofSingular.setStderrToPipe();
+    intoSingular.closeIn();
+    intoSingular.closeOut();
+    outofSingular.closeIn();
+    outofSingular.closeOut();
+    setsid();
 
     // Begin: Just for debug!!
     //system("/home/wcbrown/bin/Singular -q --no-warn --min-time=0.001 --ticks-per-sec=1000 | tee /tmp/SingOutLog");
@@ -30,9 +37,10 @@
 	   "--ticks-per-sec=1000",
 	   NULL);
       perror("SingularServer Constructor: Singular startup failed! (Set SINGULAR environment variable)");
-      outofSingular.closeOut();
       exit(0);
   }
+  intoSingular.closeIn();
+  outofSingular.closeOut();
 }
 
 SingularServer::~SingularServer()
--- a/source/db/unnamedpipe.h
+++ b/source/db/unnamedpipe.h
@@ -113,6 +113,7 @@
   int fdout() { return fd[1]; }
   int setStdinToPipe() { return dup2(fdin(),fileno(stdin)); }
   int setStdoutToPipe() { return dup2(fdout(),fileno(stdout)); }
+  int setStderrToPipe() { return dup2(fdout(),fileno(stderr)); }
   void closeIn() { 
     if (_in) { delete _in; _in = 0; }
     if (openmask[0]) { close(fd[0]); openmask[0] = false; }