fork() failure to create pseudo process sets errno=EAGAIN and returns
Gurusamy Sarathy [Mon, 8 May 2000 12:52:28 +0000 (12:52 +0000)]
undef on windows (from Clinton Pierce <clintp@geeksalad.org>)

p4raw-id: //depot/perl@6093

pp_sys.c
sv.c
win32/perlhost.h

index 6bc9f8b..b661a88 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3679,6 +3679,8 @@ PP(pp_fork)
     EXTEND(SP, 1);
     PERL_FLUSHALL_FOR_CHILD;
     childpid = PerlProc_fork();
+    if (childpid == -1)
+       RETSETUNDEF;
     PUSHi(childpid);
     RETURN;
 #  else
diff --git a/sv.c b/sv.c
index fb68efa..5517355 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3467,7 +3467,7 @@ Perl_sv_insert(pTHX_ SV *bigstr, STRLEN offset, STRLEN len, char *little, STRLEN
     if (!bigstr)
        Perl_croak(aTHX_ "Can't modify non-existent substring");
     SvPV_force(bigstr, curlen);
-    SvPOK_only_UTF8(bigstr);
+    (void)SvPOK_only_UTF8(bigstr);
     if (offset + len > curlen) {
        SvGROW(bigstr, offset+len+1);
        Zero(SvPVX(bigstr)+curlen, offset+len-curlen, char);
index cac05b2..51e125b 100644 (file)
@@ -1770,8 +1770,10 @@ PerlProcFork(struct IPerlProc* piPerl)
                          (LPVOID)new_perl, 0, &id);
 #    endif
     PERL_SET_THX(aTHXo);       /* XXX perl_clone*() set TLS */
-    if (!handle)
-       Perl_croak(aTHX_ "panic: pseudo fork() failed");
+    if (!handle) {
+       errno = EAGAIN;
+       return -1;
+    }
     w32_pseudo_child_handles[w32_num_pseudo_children] = handle;
     w32_pseudo_child_pids[w32_num_pseudo_children] = id;
     ++w32_num_pseudo_children;