diff options
author | Neal H. Walfield <neal@gnu.org> | 2002-03-26 19:07:55 +0000 |
---|---|---|
committer | Neal H. Walfield <neal@gnu.org> | 2002-03-26 19:07:55 +0000 |
commit | 113f86089440d1d87fac1962432f40edcc57248e (patch) | |
tree | d5996ee3357d5d5142b078faf41b95bd92a3baad /nfs | |
parent | 928dab1dc1114c85e73ee72f09b7549416b08306 (diff) |
2002-03-23 James A. Morrison <ja2morri@uwaterloo.ca>
* main.c (main): Use error, not perror and exit. Use ERR, not errno.
* mount.c (mount_root): Likewise.
* rpc.c (rpc_receive_thread): Use error, not perror.
Diffstat (limited to 'nfs')
-rw-r--r-- | nfs/main.c | 14 | ||||
-rw-r--r-- | nfs/mount.c | 41 | ||||
-rw-r--r-- | nfs/rpc.c | 5 |
3 files changed, 30 insertions, 30 deletions
@@ -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, struct argp_state *state) 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} }; @@ -378,14 +379,11 @@ main (int argc, char **argv) } while ((ret == -1) && (errno == EADDRINUSE)); if (ret == -1) - { - perror ("binding main udp socket"); - exit (1); - } + error (1, errno, "binding main udp socket"); - 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)); diff --git a/nfs/mount.c b/nfs/mount.c index eb7165ac..c013ae86 100644 --- a/nfs/mount.c +++ b/nfs/mount.c @@ -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; @@ -145,14 +146,14 @@ mount_root (char *name, char *host) if (connect (main_udp_socket, (struct sockaddr *)&addr, sizeof (struct sockaddr_in)) == -1) { - perror ("server mount program"); + error (0, errno, "server mount program"); return 0; } p = pmap_initialize_rpc (PMAPPROC_GETPORT, &rpcbuf); if (! p) { - perror ("creating rpc packet"); + error (0, errno, "creating rpc packet"); return 0; } @@ -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); @@ -170,7 +171,7 @@ mount_root (char *name, char *host) addr.sin_port = htons (mount_port); else { - perror ("portmap of mount"); + error (0, err, "portmap of mount"); goto error_with_rpcbuf; } free (rpcbuf); @@ -181,31 +182,31 @@ mount_root (char *name, char *host) if (connect (main_udp_socket, (struct sockaddr *) &addr, sizeof (struct sockaddr_in)) == -1) { - perror ("connect"); + error (0, errno, "connect"); goto error_with_rpcbuf; } p = mount_initialize_rpc (MOUNTPROC_MNT, &rpcbuf); if (! p) { - perror ("rpc"); + error (0, errno, "rpc"); goto error_with_rpcbuf; } p = xdr_encode_string (p, name); - errno = conduct_rpc (&rpcbuf, &p); - if (errno) + err = conduct_rpc (&rpcbuf, &p); + if (err) { - perror (name); + error (0, err, name); goto error_with_rpcbuf; } /* XXX Protocol spec says this should be a "unix error code"; we'll pretend that an NFS error code is what's meant; the numbers match anyhow. */ - errno = nfs_error_trans (htonl (*p++)); - if (errno) + err = nfs_error_trans (htonl (*p++)); + if (err) { - perror (name); + error (0, err, name); goto error_with_rpcbuf; } @@ -223,28 +224,28 @@ mount_root (char *name, char *host) if (connect (main_udp_socket, (struct sockaddr *) &addr, sizeof (struct sockaddr_in)) == -1) { - perror ("connect"); + error (0, errno, "connect"); return 0; } p = pmap_initialize_rpc (PMAPPROC_GETPORT, &rpcbuf); if (! p) { - perror ("rpc"); + error (0, errno, "rpc"); goto error_with_rpcbuf; } *p++ = htonl (NFS_PROGRAM); *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; else { - perror ("portmap of nfs server"); + error (0, err, "portmap of nfs server"); goto error_with_rpcbuf; } free (rpcbuf); @@ -254,7 +255,7 @@ mount_root (char *name, char *host) if (connect (main_udp_socket, (struct sockaddr *) &addr, sizeof (struct sockaddr_in)) == -1) { - perror ("connect"); + error (0, errno, "connect"); return 0; } @@ -1,5 +1,5 @@ /* SunRPC management for NFS client - Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation + Copyright (C) 1994, 1995, 1996, 1997, 2002 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 @@ -33,6 +33,7 @@ #include <netinet/in.h> #include <assert.h> #include <errno.h> +#include <error.h> #include <unistd.h> #include <stdio.h> @@ -370,7 +371,7 @@ rpc_receive_thread () int cc = read (main_udp_socket, buf, 1024 + read_size); if (cc == -1) { - perror ("nfs read"); + error (0, errno, "nfs read"); continue; } else |