From 5942bd6f73499f198b23975b8d7b8df1383934d8 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sun, 29 Sep 2002 15:11:59 +0000 Subject: 2002-09-29 Marcus Brinkmann * mount.c (mount_root): Add parenthesis for post-decrement (even though it is only used as an lvalue here). Increment P after using it in the macro, not within. * rpc.c (initialize_rpc, conduct_rpc): Likewise. * ops.c (process_returned_stat, process_wcc_stat, netfs_validate_stat, netfs_attempt_chown, netfs_attempt_chmod, netfs_attempt_utimes, netfs_attempt_set_size, netfs_attempt_statfs, netfs_attempt_read, netfs_attempt_write, verify_nonexistent, netfs_attempt_lookup, netfs_attempt_mkdir, netfs_attempt_rmdir, netfs_attempt_link, netfs_attempt_create_file, netfs_attempt_unlink, netfs_attempt_rename, netfs_attempt_readlink, netfs_report_access, netfs_check_open_permissions): Likewise. (fetch_directory): Likewise. Also use memcpy instead bcopy. * cache.c (recache_handle): Likewise. * nfs.c (xdr_encode_data, xdr_encode_sattr_mode, xdr_encode_sattr_ids, xdr_encode_sattr_size, xdr_encode_sattr_times, xdr_encode_create_state, xdr_encode_sattr_stat, xdr_decode_64bit, xdr_decode_fattr): Likewise. (xdr_decode_string): Likewise. Also use memcpy instead bcopy. (xdr_decode_fhandle): Likewise. Also use memcpy instead bcopy. --- nfs/mount.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'nfs/mount.c') diff --git a/nfs/mount.c b/nfs/mount.c index 3ead073f..07dbb19b 100644 --- a/nfs/mount.c +++ b/nfs/mount.c @@ -116,7 +116,7 @@ mount_root (char *name, char *host) argument is either "tcp" or "udp" Thus, is this backwards (as service_name suggests)? If so, should it read: s = getservbyname (pmap_service_name, "udp"); - or is there something I am missing here? */ + or is there something I am missing here? */ s = getservbyname ("sunrpc", pmap_service_name); if (s) pmapport = s->s_port; @@ -158,14 +158,15 @@ mount_root (char *name, char *host) return 0; } - *p++ = htonl (MOUNTPROG); - *p++ = htonl (MOUNTVERS); - *p++ = htonl (IPPROTO_UDP); - *p++ = htonl (0); + *(p++) = htonl (MOUNTPROG); + *(p++) = htonl (MOUNTVERS); + *(p++) = htonl (IPPROTO_UDP); + *(p++) = htonl (0); err = conduct_rpc (&rpcbuf, &p); if (!err) { - port = ntohl (*p++); + port = ntohl (*p); + p++; addr.sin_port = htons (port); } else if (mount_port) @@ -204,7 +205,8 @@ mount_root (char *name, char *host) /* 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. */ - err = nfs_error_trans (htonl (*p++)); + err = nfs_error_trans (htonl (*p)); + p++; if (err) { error (0, err, name); @@ -235,13 +237,16 @@ mount_root (char *name, char *host) error (0, errno, "rpc"); goto error_with_rpcbuf; } - *p++ = htonl (NFS_PROGRAM); - *p++ = htonl (NFS_VERSION); - *p++ = htonl (IPPROTO_UDP); - *p++ = htonl (0); + *(p++) = htonl (NFS_PROGRAM); + *(p++) = htonl (NFS_VERSION); + *(p++) = htonl (IPPROTO_UDP); + *(p++) = htonl (0); err = conduct_rpc (&rpcbuf, &p); if (!err) - port = ntohl (*p++); + { + port = ntohl (*p); + p++; + } else if (nfs_port) port = nfs_port; else -- cgit v1.2.3