summaryrefslogtreecommitdiff
path: root/os2
diff options
context:
space:
mode:
authorYitzchak Scott-Thoennes <sthoenna@efn.org>2000-11-30 12:50:37 -0800
committerJarkko Hietaniemi <jhi@iki.fi>2000-12-04 16:05:25 +0000
commita03d92b298c01506369c0fcdc195b8fe687f9f3a (patch)
tree75469a7bb62d282ce06ae8a836b7e76761b723a7 /os2
parentdb332f3bb66861fe23fc47f86cbb0a2d9ea03129 (diff)
downloadperl-a03d92b298c01506369c0fcdc195b8fe687f9f3a.tar.gz
Re: [ID 20001129.009] Not OK: perl v5.7.0 +DEVEL7928 on os2-64int-ld 2.30 (UNINSTALLED)
Message-ID: <d4yJ6gzkgGsJ092yn@efn.org> p4raw-id: //depot/perl@7975
Diffstat (limited to 'os2')
-rw-r--r--os2/os2.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/os2/os2.c b/os2/os2.c
index c324cf20f1..6faa415ffb 100644
--- a/os2/os2.c
+++ b/os2/os2.c
@@ -21,6 +21,7 @@
#include <process.h>
#include <fcntl.h>
+#define PERLIO_NOT_STDIO 0
#include "EXTERN.h"
#include "perl.h"
@@ -605,8 +606,9 @@ do_spawn_ve(pTHX_ SV *really, U32 flag, U32 execf, char *inicmd, U32 addflag)
char *scr = find_script(PL_Argv[0], TRUE, NULL, 0);
if (scr) {
- FILE *file;
- char *s = 0, *s1;
+ PerlIO *file;
+ SSize_t rd;
+ char *s = 0, *s1, *s2;
int l;
l = strlen(scr);
@@ -622,14 +624,18 @@ do_spawn_ve(pTHX_ SV *really, U32 flag, U32 execf, char *inicmd, U32 addflag)
Safefree(scr);
scr = scrbuf;
- file = fopen(scr, "r");
+ file = PerlIO_open(scr, "r");
PL_Argv[0] = scr;
if (!file)
goto panic_file;
- if (!fgets(buf, sizeof buf, file)) { /* Empty... */
+ rd = PerlIO_read(file, buf, sizeof buf-1);
+ buf[rd]='\0';
+ if ((s2 = strchr(buf, '\n')) != NULL) *++s2 = '\0';
+
+ if (!rd) { /* Empty... */
buf[0] = 0;
- fclose(file);
+ PerlIO_close(file);
/* Special case: maybe from -Zexe build, so
there is an executable around (contrary to
documentation, DosQueryAppType sometimes (?)
@@ -648,7 +654,7 @@ do_spawn_ve(pTHX_ SV *really, U32 flag, U32 execf, char *inicmd, U32 addflag)
} else
goto longbuf;
}
- if (fclose(file) != 0) { /* Failure */
+ if (PerlIO_close(file) != 0) { /* Failure */
panic_file:
Perl_warner(aTHX_ WARN_EXEC, "Error reading \"%s\": %s",
scr, Strerror(errno));