You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Havard <br...@kheldar.apana.org.au> on 1998/05/21 11:54:00 UTC
PATCH: OS/2 scripts using #! fix
For reasons I've yet to determine the OS/2 exe is compiled with a switch
that makes fopen() default to binary mode (-Zbin-files). This makes the !#
parser in ap_call_exec() fail on scripts that use CR/LF line terminators.
The following patch fixes that. Note that the code affected is inside an
#ifdef __EMX__ so there's no chance of breaking other platforms.
Index: util_script.c
===================================================================
RCS file: /cvs/apache-1.3/src/main/util_script.c,v
retrieving revision 1.110
diff -u -w -r1.110 util_script.c
--- util_script.c 1998/05/16 16:34:48 1.110
+++ util_script.c 1998/05/21 09:33:49
@@ -641,7 +641,7 @@
int is_script;
char interpreter[2048]; /* hope this is large enough for the interpreter path */
FILE *program;
- program = fopen(r->filename, "r");
+ program = fopen(r->filename, "rt");
if (!program) {
ap_log_error(APLOG_MARK, APLOG_ERR, r->server, "fopen(%s) failed",
r->filename);
--
______________________________________________________________________________
| Brian Havard | "He is not the messiah! |
| brianh@kheldar.apana.org.au | He's a very naughty boy!" - Life of Brian |
------------------------------------------------------------------------------
Re: PATCH: OS/2 scripts using #! fix
Posted by Brian Behlendorf <br...@hyperreal.org>.
Great, it's now been committed.
Brian
At 07:54 PM 5/21/98 +1000, you wrote:
>For reasons I've yet to determine the OS/2 exe is compiled with a switch
>that makes fopen() default to binary mode (-Zbin-files). This makes the !#
>parser in ap_call_exec() fail on scripts that use CR/LF line terminators.
>The following patch fixes that. Note that the code affected is inside an
>#ifdef __EMX__ so there's no chance of breaking other platforms.
>
>Index: util_script.c
>===================================================================
>RCS file: /cvs/apache-1.3/src/main/util_script.c,v
>retrieving revision 1.110
>diff -u -w -r1.110 util_script.c
>--- util_script.c 1998/05/16 16:34:48 1.110
>+++ util_script.c 1998/05/21 09:33:49
>@@ -641,7 +641,7 @@
> int is_script;
> char interpreter[2048]; /* hope this is large enough for the interpreter
path */
> FILE *program;
>- program = fopen(r->filename, "r");
>+ program = fopen(r->filename, "rt");
> if (!program) {
> ap_log_error(APLOG_MARK, APLOG_ERR, r->server, "fopen(%s) failed",
> r->filename);
>
>--
>
______________________________________________________________________________
> | Brian Havard | "He is not the messiah!
|
> | brianh@kheldar.apana.org.au | He's a very naughty boy!" - Life of
Brian |
>
------------------------------------------------------------------------------
>
>
--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
pure chewing satisfaction brian@apache.org
brian@hyperreal.org