Ok, I've grep'd through the hurd source looking for instances of errno being
assigned directly.  These seem to be the places where setting errno isn't 
right.  I've also changed !var to var == MACH_PORT_NULL where appropriate 
because some documentation, mach.texi, says MACH_PORT_NULL is not assumed to
be 0 in the Hurd system.

So how does the change log look?

2002-03-14  James A. Morrison  <[EMAIL PROTECTED]>

daemons: 
        * console-run.c (open_console): Use err, not errno.
        
fstests:

        * opendisk.c: Use err, not errno.
init:
        * init.c (reboot_mach): Use err, not errno.
        (run): Likewise.
        (launch_core_servers): Likewise.
        (run_for_real): Check file is equal to MACH_PORT_NULL, not !file.
        (start_child): Likewise.

libnetfs:

        * make-protid.c (netfs_make_protid): Use err, not errno.

nfs:
        * main.c (main): Use err, not errno.
        * mount.c (mount_root): Likewise.
        * fsys.c (init_filesystems): Check root is equal to MACH_PORT_NULL, 
        not !root.
        (write_filesystems): Use err, not errno.

term:
        * main.c (main): Use err, not errno.
        * users.c (init_users): Likewise.

trans:
        * ifsock.c (main): Use err, not errno.
utils:
        * rpctrace (parse_msgid_list): Use err, not errno.
        * shd.c (run): Likewise.


Index: daemons/console-run.c
===================================================================
RCS file: /cvsroot/hurd/hurd/daemons/console-run.c,v
retrieving revision 1.4
diff -u -p -r1.4 console-run.c
--- daemons/console-run.c       30 Jan 2001 23:45:31 -0000      1.4
+++ daemons/console-run.c       15 Mar 2002 02:38:46 -0000
@@ -1,5 +1,5 @@
 /* Run a program on the console, trying hard to get the console open.
-   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001,02 Free Software Foundation, Inc.
 
    This file is part of the GNU Hurd.
 
@@ -141,21 +141,21 @@ open_console (char **namep)
          termname = terminal + strlen (terminal) + 1; /* first arg is name */
 
          /* The callback to start_translator opens TERM as a side effect.  */
-         errno =
+         err =
            fshelp_start_translator (open_node, NULL, terminal, terminal,
                                     argz_len, 3000, &control);
-         if (errno)
+         if (err)
            {
-             error (0, errno, "%s", terminal);
+             error (0, err, "%s", terminal);
              continue;
            }
 
-         errno = file_set_translator (term, 0, FS_TRANS_SET, 0, 0, 0,
+         err = file_set_translator (term, 0, FS_TRANS_SET, 0, 0, 0,
                                       control, MACH_MSG_TYPE_COPY_SEND);
          mach_port_deallocate (mach_task_self (), control);
-         if (errno)
+         if (err)
            {
-             error (0, errno, "%s", termname);
+             error (0, err, "%s", termname);
              continue;
            }
          mach_port_deallocate (mach_task_self (), term);
@@ -167,10 +167,10 @@ open_console (char **namep)
              error (0, errno, "%s", termname);
              continue;
            }
-         errno = io_stat (term, &st);
-         if (errno)
+         err = io_stat (term, &st);
+         if (err)
            {
-             error (0, errno, "%s", termname);
+             error (0, err, "%s", termname);
              term = MACH_PORT_NULL;
              continue;
            }
Index: fstests/opendisk.c
===================================================================
RCS file: /cvsroot/hurd/hurd/fstests/opendisk.c,v
retrieving revision 1.3
diff -u -p -r1.3 opendisk.c
--- fstests/opendisk.c  9 Sep 1994 16:06:52 -0000       1.3
+++ fstests/opendisk.c  15 Mar 2002 02:38:48 -0000
@@ -1,5 +1,5 @@
 /* Attempt to open a disk device
-   Copyright (C) 1994 Free Software Foundation, Inc.
+   Copyright (C) 1994,2002 Free Software Foundation, Inc.
    Written by Michael I. Bushnell.
 
    This file is part of the GNU Hurd.
@@ -23,8 +23,10 @@
 #include <errno.h>
 #include <hurd.h>
 #include <stdio.h>
+#include <error.h>
 
 /* Boneheaded CMU people decided to gratuitously screw us. */
+/* is this anywhere else now? */
 #include "/gd/gnu/mach/sys/ioctl.h"
 
 #define DKTYPENAMES
@@ -37,29 +39,30 @@ main (int argc, char **argv)
   mach_port_t device;
   int sizes[DEV_GET_SIZE_COUNT];
   int sizescnt = DEV_GET_SIZE_COUNT;
+  error_t err;
   struct disklabel label;
   int labelcnt = sizeof label / sizeof (int);
   int i;
 
-  errno = get_privileged_ports (&hostpriv, &devicemaster);
+  err = get_privileged_ports (&hostpriv, &devicemaster);
   
-  if (errno)
+  if (err)
     {
       perror ("Cannot get privileged ports");
       exit (1);
     }
   
-  errno = device_open (devicemaster, D_READ, argv[1], &device);
+  err = device_open (devicemaster, D_READ, argv[1], &device);
   
-  if (errno)
+  if (err)
     {
       perror (argv[1]);
       exit (1);
     }
   
-  errno = device_get_status (device, DEV_GET_SIZE, sizes, &sizescnt);
+  err = device_get_status (device, DEV_GET_SIZE, sizes, &sizescnt);
   
-  if (errno)
+  if (err)
     {
       perror ("device_get_status");
       exit (1);
@@ -69,9 +72,9 @@ main (int argc, char **argv)
          sizes[DEV_GET_SIZE_RECORD_SIZE], sizes[DEV_GET_SIZE_DEVICE_SIZE]);
 
 
-  errno = device_get_status (device, DIOCGDINFO, &label, &labelcnt);
+  err = device_get_status (device, DIOCGDINFO, &label, &labelcnt);
 
-  if (errno)
+  if (err)
     {
       perror ("reading disk label");
       exit (1);
Index: init/init.c
===================================================================
RCS file: /cvsroot/hurd/hurd/init/init.c,v
retrieving revision 1.127
diff -u -p -r1.127 init.c
--- init/init.c 2 Jan 2002 11:21:41 -0000       1.127
+++ init/init.c 15 Mar 2002 02:38:49 -0000
@@ -171,12 +171,13 @@ reboot_mach (int flags)
     }
   else
     {
+      error_t err;
       printf ("%s: %sing Mach (flags %#x)...\n",
              program_invocation_short_name, BOOT (flags), flags);
       fflush (stdout);
       sleep (5);
-      while ((errno = host_reboot (host_priv, flags)))
-       error (0, errno, "reboot");
+      while ((err = host_reboot (host_priv, flags)))
+       error (0, err, "reboot");
       for (;;);
     }
 }
@@ -357,6 +358,7 @@ run (const char *server, mach_port_t *po
   while (1)
     {
       file_t file;
+      error_t err;
 
       file = file_name_lookup (prog, O_EXEC, 0);
       if (file == MACH_PORT_NULL)
@@ -373,17 +375,17 @@ run (const char *server, mach_port_t *po
              printf ("Pausing for %s\n", prog);
              getchar ();
            }
-         errno = file_exec (file, *task, 0,
-                            (char *)prog, strlen (prog) + 1, /* Args.  */
-                            startup_envz, startup_envz_len,
-                            default_dtable, MACH_MSG_TYPE_COPY_SEND, 3,
-                            ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX,
-                            default_ints, INIT_INT_MAX,
-                            NULL, 0, NULL, 0);
-         if (!errno)
+         err = file_exec (file, *task, 0,
+                          (char *)prog, strlen (prog) + 1, /* Args.  */
+                          startup_envz, startup_envz_len,
+                          default_dtable, MACH_MSG_TYPE_COPY_SEND, 3,
+                          ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX,
+                          default_ints, INIT_INT_MAX,
+                          NULL, 0, NULL, 0);
+         if (!err)
            break;
 
-         error (0, errno, "%s", prog);
+         error (0, err, "%s", prog);
        }
 
       printf ("File name for server %s (or nothing to reboot): ", server);
@@ -426,13 +428,13 @@ run_for_real (char *filename, char *args
       if (getstring (buf, sizeof (buf)) && *buf)
        filename = buf;
       file = file_name_lookup (filename, O_EXEC, 0);
-      if (!file)
+      if ( file == MACH_PORT_NULL )
        error (0, errno, "%s", filename);
     }
-  while (!file);
+  while ( file == MACH_PORT_NULL );
 #else
   file = file_name_lookup (filename, O_EXEC, 0);
-  if (!file)
+  if ( file == MACH_PORT_NULL )
     {
       error (0, errno, "%s", filename);
       return 0;
@@ -692,10 +694,10 @@ launch_core_servers (void)
     mach_port_deallocate (mach_task_self (), old);
 
   /* Give the bootstrap FS its proc and auth ports.  */
-  errno = fsys_init (bootport, fsproc, MACH_MSG_TYPE_COPY_SEND, authserver);
+  err = fsys_init (bootport, fsproc, MACH_MSG_TYPE_COPY_SEND, authserver);
   mach_port_deallocate (mach_task_self (), fsproc);
-  if (errno)
-    error (0, errno, "fsys_init"); /* Not necessarily fatal.  */
+  if (err)
+    error (0, err, "fsys_init"); /* Not necessarily fatal.  */
 }
 
 /* Set up the initial value of the standard exec data. */
@@ -1029,7 +1031,7 @@ start_child (const char *prog, char **pr
   assert_perror (err);
 
   file = file_name_lookup (args, O_EXEC, 0);
-  if (!file)
+  if ( file == MACH_PORT_NULL )
     {
       error (0, errno, "%s", args);
       free (args);
Index: libnetfs/make-protid.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libnetfs/make-protid.c,v
retrieving revision 1.6
diff -u -p -r1.6 make-protid.c
--- libnetfs/make-protid.c      18 Nov 1996 23:51:10 -0000      1.6
+++ libnetfs/make-protid.c      15 Mar 2002 02:38:50 -0000
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 2002 Free Software Foundation, Inc.
    Written by Michael I. Bushnell, p/BSG.
 
    This file is part of the GNU Hurd.
@@ -23,18 +23,22 @@
 struct protid *
 netfs_make_protid (struct peropen *po, struct iouser *cred)
 {
+  error_t err;
   struct protid *pi;
 
   if (cred)
-    errno = ports_create_port (netfs_protid_class, netfs_port_bucket, 
+    err = ports_create_port (netfs_protid_class, netfs_port_bucket, 
                               sizeof (struct protid), &pi);
   else
-    errno = ports_create_port_noinstall (netfs_protid_class,
+    err = ports_create_port_noinstall (netfs_protid_class,
                                         netfs_port_bucket, 
                                         sizeof (struct protid), &pi);
     
-  if (errno)
-    return 0;
+  if (err)
+    {
+      errno = err;
+      return 0;
+    }
 
   po->refcnt++;
   pi->po = po;
@@ -43,3 +47,4 @@ netfs_make_protid (struct peropen *po, s
   pi->mapped = 0;
   return pi;
 }
+
Index: nfs/main.c
===================================================================
RCS file: /cvsroot/hurd/hurd/nfs/main.c,v
retrieving revision 1.29
diff -u -p -r1.29 main.c
--- nfs/main.c  30 Jan 2001 00:38:45 -0000      1.29
+++ nfs/main.c  15 Mar 2002 02:38:52 -0000
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
    Written by Michael I. Bushnell, p/BSG.
 
    This file is part of the GNU Hurd.
@@ -345,6 +345,7 @@ parse_startup_opt (int key, char *arg, s
 int
 main (int argc, char **argv)
 {
+  error_t err;
   struct argp common_argp = { common_options, parse_common_opt };
   const struct argp_child argp_children[] =
     { {&common_argp}, {&netfs_std_startup_argp}, {0} };
@@ -383,9 +384,9 @@ main (int argc, char **argv)
       exit (1);
     }
 
-  errno = maptime_map (0, 0, &mapped_time);
-  if (errno)
-    error (2, errno, "mapping time");
+  err = maptime_map (0, 0, &mapped_time);
+  if (err)
+    error (2, err, "mapping time");
 
   cthread_detach (cthread_fork ((cthread_fn_t) timeout_service_thread, 0));
   cthread_detach (cthread_fork ((cthread_fn_t) rpc_receive_thread, 0));
Index: nfs/mount.c
===================================================================
RCS file: /cvsroot/hurd/hurd/nfs/mount.c,v
retrieving revision 1.24
diff -u -p -r1.24 mount.c
--- nfs/mount.c 29 Dec 2001 00:40:09 -0000      1.24
+++ nfs/mount.c 15 Mar 2002 02:38:52 -0000
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1995,96,97,98,2001 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,98,2001,02 Free Software Foundation, Inc.
    Written by Michael I. Bushnell, p/BSG.
 
    This file is part of the GNU Hurd.
@@ -101,6 +101,7 @@ mount_root (char *name, char *host)
   int *p;
   void *rpcbuf;
   int port;
+  error_t err;
   struct node *np;
   short pmapport;
 
@@ -160,8 +161,8 @@ mount_root (char *name, char *host)
       *p++ = htonl (MOUNTVERS);
       *p++ = htonl (IPPROTO_UDP);
       *p++ = htonl (0);
-      errno = conduct_rpc (&rpcbuf, &p);
-      if (!errno)
+      err = conduct_rpc (&rpcbuf, &p);
+      if (!err)
        {
          port = ntohl (*p++);
          addr.sin_port = htons (port);
@@ -193,8 +194,8 @@ mount_root (char *name, char *host)
     }
 
   p = xdr_encode_string (p, name);
-  errno = conduct_rpc (&rpcbuf, &p);
-  if (errno)
+  err = conduct_rpc (&rpcbuf, &p);
+  if (err)
     {
       perror (name);
       goto error_with_rpcbuf;
@@ -237,8 +238,8 @@ mount_root (char *name, char *host)
       *p++ = htonl (NFS_VERSION);
       *p++ = htonl (IPPROTO_UDP);
       *p++ = htonl (0);
-      errno = conduct_rpc (&rpcbuf, &p);
-      if (!errno)
+      err = conduct_rpc (&rpcbuf, &p);
+      if (!err)
        port = ntohl (*p++);
       else if (nfs_port)
        port = nfs_port;
Index: nfsd/fsys.c
===================================================================
RCS file: /cvsroot/hurd/hurd/nfsd/fsys.c,v
retrieving revision 1.2
diff -u -p -r1.2 fsys.c
--- nfsd/fsys.c 7 Aug 1996 19:03:28 -0000       1.2
+++ nfsd/fsys.c 15 Mar 2002 02:38:52 -0000
@@ -1,5 +1,5 @@
 /* Filesystem management for NFS server
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 2002 Free Software Foundation, Inc.
    Written by Michael I. Bushnell, p/BSG.
 
    This file is part of the GNU Hurd.
@@ -87,7 +87,7 @@ init_filesystems (void)
        }
 
       root = file_name_lookup (name, 0, 0);
-      if (!root)
+      if (root == MACH_PORT_NULL)
        {
          fprintf (stderr, "%s:%s:%d Filesystem `%s': %s\n",
                   program_invocation_name, index_file_name, line,
@@ -123,6 +123,7 @@ write_filesystems (void)
 {
   file_t newindex;
   FILE *f;
+  error_t err;
   int i;
 
   if (!index_file_name)
@@ -141,11 +142,11 @@ write_filesystems (void)
     }
 
   /* Create an anonymous file in the same directory */
-  errno = dir_mkfile (index_file_dir, O_WRONLY, 0666, &newindex);
-  if (errno)
+  err = dir_mkfile (index_file_dir, O_WRONLY, 0666, &newindex);
+  if (err)
     {
       fprintf (stderr, "%s: `%s': %s\n",
-              program_invocation_name, index_file_name, strerror (errno));
+              program_invocation_name, index_file_name, strerror (err));
       index_file_name = 0;
       mach_port_deallocate (mach_task_self (), index_file_dir);
       index_file_dir = MACH_PORT_NULL;
@@ -159,10 +160,10 @@ write_filesystems (void)
       fprintf (f, "%d %s\n", i, fsystable[i].name);
 
   /* Link it in */
-  errno = dir_link (index_file_dir, newindex, index_file_compname, 0);
-  if (errno)
+  err = dir_link (index_file_dir, newindex, index_file_compname, 0);
+  if (err)
     fprintf (stderr, "%s: `%s': %s\n",
-            program_invocation_name, index_file_name, strerror (errno));
+            program_invocation_name, index_file_name, strerror (err));
   fflush (f);
   file_sync (newindex, 1, 0);
   fclose (f);
Index: term/main.c
===================================================================
RCS file: /cvsroot/hurd/hurd/term/main.c,v
retrieving revision 1.27
diff -u -p -r1.27 main.c
--- term/main.c 5 Mar 2002 02:17:04 -0000       1.27
+++ term/main.c 15 Mar 2002 02:38:58 -0000
@@ -26,6 +26,7 @@
 #include <argp.h>
 #include <hurd/fsys.h>
 #include <string.h>
+#include <error.h>
 
 #include <version.h>
 
@@ -148,6 +149,7 @@ main (int argc, char **argv)
   struct trivfs_control **ourcntl, **peercntl;
   mach_port_t bootstrap, right;
   struct stat st;
+  error_t err;
 
   term_bucket = ports_create_bucket ();
   
@@ -219,10 +221,10 @@ main (int argc, char **argv)
     }
 
   /* Set our node.  */
-  errno = trivfs_startup (bootstrap, 0,
+  err = trivfs_startup (bootstrap, 0,
                          ourcntlclass, term_bucket, ourclass, term_bucket,
                          ourcntl);
-  if (errno)
+  if (err)
     {
       perror ("Starting translator");
       exit (1);
@@ -238,21 +240,21 @@ main (int argc, char **argv)
       char *peer_name = tty_arg;
       file_t file = file_name_lookup (peer_name, O_CREAT|O_NOTRANS, 0666);
 
-      if (file != MACH_PORT_NULL)
-       errno = 0;
+      if (file == MACH_PORT_NULL)
+       err = errno;
 
-      if (! errno)
-       errno = trivfs_create_control (file, peercntlclass, term_bucket,
-                                      peerclass, term_bucket, peercntl);
-      if (! errno)
+      if (! err)
+       err = trivfs_create_control (file, peercntlclass, term_bucket,
+                                    peerclass, term_bucket, peercntl);
+      if (! err)
        {
          right = ports_get_send_right (*peercntl);
-         errno = file_set_translator (file, 0, FS_TRANS_EXCL | FS_TRANS_SET,
+         err = file_set_translator (file, 0, FS_TRANS_EXCL | FS_TRANS_SET,
                                     0, 0, 0, right, MACH_MSG_TYPE_COPY_SEND);
          mach_port_deallocate (mach_task_self (), right);
        }
 
-      if (errno)
+      if (err)
        {
          perror (peer_name);
          exit (1);
@@ -268,12 +270,13 @@ main (int argc, char **argv)
 
   /* Initialize status from underlying node.  */
   errno = io_stat ((*ourcntl)->underlying, &st);
-  if (errno)
+  if (err)
     {
       /* We cannot stat the underlying node.  Fallback to the defaults.  */
       term_owner = term_group = 0;
       term_mode = (bottom == &ptyio_bottom ? DEFFILEMODE : S_IRUSR | S_IWUSR);
       errno = 0;
+      err = 0;
     }
   else
     {
@@ -289,8 +292,8 @@ main (int argc, char **argv)
   
   outputq = create_queue (256, QUEUE_LOWAT, QUEUE_HIWAT);
   
-  errno = (*bottom->init) ();
-  if (errno)
+  err = (*bottom->init) ();
+  if (err)
     {
       perror ("Initializing bottom handler");
       exit (1);
Index: term/users.c
===================================================================
RCS file: /cvsroot/hurd/hurd/term/users.c,v
retrieving revision 1.96
diff -u -p -r1.96 users.c
--- term/users.c        5 Mar 2002 02:17:04 -0000       1.96
+++ term/users.c        15 Mar 2002 02:38:59 -0000
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <hurd/iohelp.h>
 #include <hurd/fshelp.h>
+#include <error.h>
 #include "ourmsg_U.h"
 
 
@@ -84,9 +85,10 @@ struct protid_hook
 void
 init_users ()
 {
-  errno = ports_create_port (cttyid_class, term_bucket,
-                            sizeof (struct port_info), &cttyid);
-  if (errno)
+  error_t err;
+  err = ports_create_port (cttyid_class, term_bucket,
+                          sizeof (struct port_info), &cttyid);
+  if (err)
     {
       perror ("Allocating cttyid");
       exit (1);
Index: trans/ifsock.c
===================================================================
RCS file: /cvsroot/hurd/hurd/trans/ifsock.c,v
retrieving revision 1.9
diff -u -p -r1.9 ifsock.c
--- trans/ifsock.c      26 Feb 2001 04:16:01 -0000      1.9
+++ trans/ifsock.c      15 Mar 2002 02:38:59 -0000
@@ -1,5 +1,5 @@
 /* Server for S_IFSOCK nodes
-   Copyright (C) 1994, 1995, 2001 Free Software Foundation
+   Copyright (C) 1994, 1995, 2001, 02 Free Software Foundation
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -89,8 +89,8 @@ main (int argc, char **argv)
     address_port = MACH_PORT_NULL;
   else
     {
-      errno = socket_fabricate_address (pflocal, AF_LOCAL, &address_port);
-      if (errno)
+      err = socket_fabricate_address (pflocal, AF_LOCAL, &address_port);
+      if (err)
        address_port = MACH_PORT_NULL;
       mach_port_deallocate (mach_task_self (), pflocal);
     }
Index: utils/rpctrace.c
===================================================================
RCS file: /cvsroot/hurd/hurd/utils/rpctrace.c,v
retrieving revision 1.11
diff -u -p -r1.11 rpctrace.c
--- utils/rpctrace.c    30 Jan 2002 12:25:44 -0000      1.11
+++ utils/rpctrace.c    15 Mar 2002 02:39:00 -0000
@@ -79,6 +79,7 @@ parse_msgid_list (const char *filename)
   unsigned int lineno = 0;
   char *name, *subsystem;
   unsigned int msgid;
+  error_t err;
 
   fp = fopen (filename, "r");
   if (fp == 0)
@@ -103,9 +104,9 @@ parse_msgid_list (const char *filename)
            error (1, errno, "malloc");
          info->name = name;
          info->subsystem = subsystem;
-         errno = ihash_add (&msgid_ihash, msgid, info, NULL);
-         if (errno)
-           error (1, errno, "ihash_add");
+         err = ihash_add (&msgid_ihash, msgid, info, NULL);
+         if (err)
+           error (1, err, "ihash_add");
        }
     }
 
Index: utils/shd.c
===================================================================
RCS file: /cvsroot/hurd/hurd/utils/shd.c,v
retrieving revision 1.8
diff -u -p -r1.8 shd.c
--- utils/shd.c 2 Jan 2002 11:22:17 -0000       1.8
+++ utils/shd.c 15 Mar 2002 02:39:00 -0000
@@ -69,6 +69,7 @@ run (char **argv, int fd0, int fd1)
 {
   file_t file;
   char *program;
+  error_t err;
 
   if (strchr (argv[0], '/') != NULL)
     program = argv[0];
@@ -92,12 +93,12 @@ run (char **argv, int fd0, int fd1)
       task_t task;
       pid_t pid;
 
-      errno = task_create (mach_task_self (),
+      err = task_create (mach_task_self (),
 #ifdef KERN_INVALID_LEDGER
                           NULL, 0,     /* OSF Mach */
 #endif
                           0, &task);
-      if (errno)
+      if (err)
        {
          perror ("task_create");
          pid = -1;
@@ -140,8 +141,8 @@ run (char **argv, int fd0, int fd1)
          pid = task2pid (task);
          if (pid == -1)
            perror ("task2pid"), pid = 0;
-         errno = proc_child (proc, task);
-         if (errno)
+         err = proc_child (proc, task);
+         if (err)
            perror ("proc_child");
          if (pause_startup)
            {
@@ -154,17 +155,17 @@ run (char **argv, int fd0, int fd1)
              movefd (fd1, 1, &save1))
            return -1;
 
-         errno = _hurd_exec (task, file, argv, environ);
+         err = _hurd_exec (task, file, argv, environ);
 
          if (restorefd (fd0, 0, &save0) ||
              restorefd (fd1, 1, &save1))
            return -1;
 
-         if (errno)
+         if (err)
            {
              perror ("_hurd_exec");
-             errno = task_terminate (task);
-             if (errno)
+             err = task_terminate (task);
+             if (err)
                perror ("task_terminate");
            }
          mach_port_deallocate (mach_task_self (), task);
@@ -172,6 +173,7 @@ run (char **argv, int fd0, int fd1)
        }
       mach_port_deallocate (mach_task_self (), file);
 
+      errno = err;
       return pid;
     }
 }

_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd

Reply via email to