Skip to content

Commit

Permalink
debian: Import patch from PR glidernet#19
Browse files Browse the repository at this point in the history
  • Loading branch information
kerel-fs committed Feb 16, 2017
1 parent 2d4678c commit a7244a9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
39 changes: 39 additions & 0 deletions debian/patches/0001-ogn-rf-Detect-if-stdin-is-a-terminal.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 09cc5b1fa1186b2f185cea54c47312f2595633e3 Mon Sep 17 00:00:00 2001
From: "Fabian P. Schmidt" <[email protected]>
Date: Fri, 10 Feb 2017 02:08:22 +0100
Subject: [PATCH] ogn-rf: Detect if stdin is a terminal

Fixes #11: Version 0.2.5 crashs with SEGV if invoked by systemd.
---
src/ogn-rf.cc | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/ogn-rf.cc b/src/ogn-rf.cc
index c9baead..5147a09 100644
--- a/src/ogn-rf.cc
+++ b/src/ogn-rf.cc
@@ -1055,10 +1055,17 @@ int main(int argc, char *argv[])
GSM.Start();
RF.Start();

- char Cmd[128];
- while(!RF.StopReq)
- { if(fgets(Cmd, 128, stdin)==0) break;
- UserCommand(Cmd); }
+ if (isatty(fileno(stdin))) {
+ char Cmd[128];
+ while(!RF.StopReq) {
+ if(fgets(Cmd, 128, stdin)==0) break;
+ UserCommand(Cmd);
+ }
+ } else {
+ while(!RF.StopReq) {
+ sleep(1);
+ }
+ }

sleep(4);
RF.Stop();
--
2.1.4

1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
0002-Move-version-string-from-Makefile-to-VERSION.txt.patch
0003-Improve-Makefile.patch
0004-Makefile-Add-all-to-phony-targets.patch
0001-ogn-rf-Detect-if-stdin-is-a-terminal.patch

0 comments on commit a7244a9

Please sign in to comment.