|
|
86775f |
From 49857a3ee79226ce870607104f7ef28bacae3f57 Mon Sep 17 00:00:00 2001
|
|
|
86775f |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
86775f |
Date: Wed, 23 Jan 2013 14:06:50 +0100
|
|
|
86775f |
Subject: [PATCH] Do not open - and /dev/stdout
|
|
|
86775f |
|
|
|
86775f |
Ported from 4.13.4pre2.
|
|
|
86775f |
<https://bugzilla.redhat.com/show_bug.cgi?id=901895>
|
|
|
86775f |
|
|
|
86775f |
I have duplicated the autogen code to C because the build system does
|
|
|
86775f |
not run autogen.
|
|
|
86775f |
---
|
|
|
86775f |
src/uudecode-opts.c | 17 ++++++++++++++++-
|
|
|
86775f |
src/uudecode-opts.def | 17 ++++++++++++++++-
|
|
|
86775f |
2 files changed, 32 insertions(+), 2 deletions(-)
|
|
|
86775f |
|
|
|
86775f |
diff --git a/src/uudecode-opts.c b/src/uudecode-opts.c
|
|
|
86775f |
index 19f4ee1..33ebe2f 100644
|
|
|
86775f |
--- a/src/uudecode-opts.c
|
|
|
86775f |
+++ b/src/uudecode-opts.c
|
|
|
86775f |
@@ -385,7 +385,22 @@ doOptOutput_File(tOptions* pOptions, tOptDesc* pOptDesc)
|
|
|
86775f |
* reset its state.
|
|
|
86775f |
*/
|
|
|
86775f |
/* extracted from uudecode-opts.def, line 60 */
|
|
|
86775f |
- FILE * fp = freopen (pOptDesc->optArg.argString, "w", stdout);
|
|
|
86775f |
+ FILE * fp;
|
|
|
86775f |
+ switch (*pOptDesc->optArg.argString)
|
|
|
86775f |
+ {
|
|
|
86775f |
+ case '-':
|
|
|
86775f |
+ if (pOptDesc->optArg.argString[1] == '\0')
|
|
|
86775f |
+ return;
|
|
|
86775f |
+ break;
|
|
|
86775f |
+
|
|
|
86775f |
+ case '/':
|
|
|
86775f |
+ if (strcmp (pOptDesc->optArg.argString + 1, "dev/stdout") == 0)
|
|
|
86775f |
+ return;
|
|
|
86775f |
+
|
|
|
86775f |
+ default:
|
|
|
86775f |
+ break;
|
|
|
86775f |
+ }
|
|
|
86775f |
+ fp = freopen (pOptDesc->optArg.argString, "w", stdout);
|
|
|
86775f |
if (fp != stdout)
|
|
|
86775f |
{
|
|
|
86775f |
error (0, errno, "%s", pOptDesc->optArg.argString);
|
|
|
86775f |
diff --git a/src/uudecode-opts.def b/src/uudecode-opts.def
|
|
|
86775f |
index ae11b0a..419387b 100644
|
|
|
86775f |
--- a/src/uudecode-opts.def
|
|
|
86775f |
+++ b/src/uudecode-opts.def
|
|
|
86775f |
@@ -57,7 +57,22 @@ flag = {
|
|
|
86775f |
arg-name = file;
|
|
|
86775f |
descrip = 'direct output to @file{file}';
|
|
|
86775f |
flag-code = <<- _EOCode_
|
|
|
86775f |
- FILE * fp = freopen (pOptDesc->optArg.argString, "w", stdout);
|
|
|
86775f |
+ FILE * fp;
|
|
|
86775f |
+ switch (*pOptDesc->optArg.argString)
|
|
|
86775f |
+ {
|
|
|
86775f |
+ case '-':
|
|
|
86775f |
+ if (pOptDesc->optArg.argString[1] == '\0')
|
|
|
86775f |
+ return;
|
|
|
86775f |
+ break;
|
|
|
86775f |
+
|
|
|
86775f |
+ case '/':
|
|
|
86775f |
+ if (strcmp (pOptDesc->optArg.argString + 1, "dev/stdout") == 0)
|
|
|
86775f |
+ return;
|
|
|
86775f |
+
|
|
|
86775f |
+ default:
|
|
|
86775f |
+ break;
|
|
|
86775f |
+ }
|
|
|
86775f |
+ fp = freopen (pOptDesc->optArg.argString, "w", stdout);
|
|
|
86775f |
if (fp != stdout)
|
|
|
86775f |
{
|
|
|
86775f |
error (0, errno, "%s", pOptDesc->optArg.argString);
|
|
|
86775f |
--
|
|
|
86775f |
1.8.1
|
|
|
86775f |
|