From a7244a9e00034628acf808969847adb97d051cff Mon Sep 17 00:00:00 2001 From: "Fabian P. Schmidt" Date: Thu, 16 Feb 2017 19:17:23 +0100 Subject: [PATCH] debian: Import patch from PR #19 --- ...ogn-rf-Detect-if-stdin-is-a-terminal.patch | 39 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 40 insertions(+) create mode 100644 debian/patches/0001-ogn-rf-Detect-if-stdin-is-a-terminal.patch diff --git a/debian/patches/0001-ogn-rf-Detect-if-stdin-is-a-terminal.patch b/debian/patches/0001-ogn-rf-Detect-if-stdin-is-a-terminal.patch new file mode 100644 index 0000000..180030c --- /dev/null +++ b/debian/patches/0001-ogn-rf-Detect-if-stdin-is-a-terminal.patch @@ -0,0 +1,39 @@ +From 09cc5b1fa1186b2f185cea54c47312f2595633e3 Mon Sep 17 00:00:00 2001 +From: "Fabian P. Schmidt" +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 + diff --git a/debian/patches/series b/debian/patches/series index c40d2a6..663eabb 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -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