* ftpfs.c: Replace bzero and bcopy with memset and memcpy.

* mcfs.c: Likewise.
* mcserv.c: Likewise.
* smbfs.c: Likewise.
* tar.c: Likewise.
This commit is contained in:
Pavel Roskin 2002-07-15 05:31:43 +00:00
parent 7db8a05550
commit 7978b33a9d
6 changed files with 29 additions and 21 deletions

View File

@ -1,3 +1,11 @@
2002-07-15 Pavel Roskin <proski@gnu.org>
* ftpfs.c: Replace bzero and bcopy with memset and memcpy.
* mcfs.c: Likewise.
* mcserv.c: Likewise.
* smbfs.c: Likewise.
* tar.c: Likewise.
2002-07-14 Pavel Roskin <proski@gnu.org>
* fish.c (open_archive_int): Don't combine "export" and

View File

@ -560,17 +560,17 @@ setup_source_route (int socket, int dest)
if (!source_route)
return;
bzero (buffer, sizeof (buffer));
memset (buffer, 0, sizeof (buffer));
*ptr++ = IPOPT_LSRR;
*ptr++ = 3 + 8;
*ptr++ = 4; /* pointer */
/* First hop */
bcopy ((char *) &source_route, ptr, sizeof (int));
memcpy (ptr, (char *) &source_route, sizeof (int));
ptr += 4;
/* Second hop (ie, final destination) */
bcopy ((char *) &dest, ptr, sizeof (int));
memcpy (ptr, (char *) &dest, sizeof (int));
ptr += 4;
while ((ptr - buffer) & 3)
ptr++;
@ -715,7 +715,7 @@ ftpfs_open_socket (vfs *me, vfs_s_super *super)
}
/* Get host address */
bzero ((char *) &server_address, sizeof (server_address));
memset ((char *) &server_address, 0, sizeof (server_address));
server_address.sin_family = AF_INET;
server_address.sin_addr.s_addr = inet_addr (host);
if (server_address.sin_addr.s_addr != -1)
@ -732,7 +732,7 @@ ftpfs_open_socket (vfs *me, vfs_s_super *super)
server_address.sin_family = hp->h_addrtype;
/* We copy only 4 bytes, we can not trust hp->h_length, as it comes from the DNS */
bcopy ((char *) hp->h_addr, (char *) &server_address.sin_addr, 4);
memcpy ((char *) &server_address.sin_addr, (char *) hp->h_addr, 4);
}
server_address.sin_port = htons (port);
@ -951,8 +951,8 @@ setup_passive (vfs *me, vfs_s_super *super, int my_socket, struct sockaddr_in *s
n [4] = (unsigned char) xe;
n [5] = (unsigned char) xf;
bcopy ((void *)n, &(sa->sin_addr.s_addr), 4);
bcopy ((void *)&n[4], &(sa->sin_port), 2);
memcpy (&(sa->sin_addr.s_addr), (void *)n, 4);
memcpy (&(sa->sin_port), (void *)&n[4], 2);
setup_source_route (my_socket, sa->sin_addr.s_addr);
if (connect (my_socket, (struct sockaddr *) sa, sizeof (struct sockaddr_in)) < 0)
return 0;

View File

@ -218,20 +218,20 @@ open_tcp_link (char *host, int *port, int *version, char *caller)
if (!*host)
return 0;
bzero ((char *) &server_address, sizeof (server_address));
memset ((char *) &server_address, 0, sizeof (server_address));
server_address.sin_family = AF_INET;
/* Try to use the dotted decimal number */
if ((inaddr = inet_addr (host)) != -1)
bcopy ((char *) &inaddr, (char *) &server_address.sin_addr,
sizeof (inaddr));
memcpy ((char *) &server_address.sin_addr, (char *) &inaddr,
sizeof (inaddr));
else {
if ((hp = gethostbyname (host)) == NULL){
message_2s (1, caller, _(" Cannot locate hostname: %s "), host);
return 0;
}
bcopy ((char *) hp->h_addr, (char *) &server_address.sin_addr,
hp->h_length);
memcpy ((char *) &server_address.sin_addr, (char *) hp->h_addr,
hp->h_length);
}
/* Try to contact a remote portmapper to obtain the listening port */

View File

@ -776,7 +776,7 @@ static int do_ftp_auth (char *username, char *password)
int my_socket;
char answer [4];
bzero ((char *) &local_address, sizeof (local_address));
memset ((char *) &local_address, 0, sizeof (local_address));
local_address.sin_family = AF_INET;
/* FIXME: extract the ftp port with the proper function */
@ -784,8 +784,8 @@ static int do_ftp_auth (char *username, char *password)
/* Convert localhost to usable format */
if ((inaddr = inet_addr ("127.0.0.1")) != -1)
bcopy ((char *) &inaddr, (char *) &local_address.sin_addr,
sizeof (inaddr));
memcpy ((char *) &local_address.sin_addr, (char *) &inaddr,
sizeof (inaddr));
if ((my_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0){
if (!isDaemon) fprintf (stderr, "do_auth: can't create socket\n");
@ -1126,7 +1126,7 @@ static char *get_client (int portnum)
if (hp == 0)
return "hp = 0!";
bzero ((char *) &server_address, sizeof (server_address));
memset ((char *) &server_address, 0, sizeof (server_address));
server_address.sin_family = hp->h_addrtype;
server_address.sin_addr.s_addr = htonl (INADDR_ANY);
server_address.sin_port = htons (portnum);

View File

@ -982,7 +982,7 @@ free_bucket (smbfs_connection *bucket)
g_free (bucket->user);
wipe_password (bucket->password);
if (bucket->home) g_free (bucket->home);
bzero (bucket, sizeof (smbfs_connection));
memset (bucket, 0, sizeof (smbfs_connection));
}
static smbfs_connection *
@ -1380,7 +1380,7 @@ get_stat_info (smbfs_connection *sc, char *path, struct stat *buf)
if ((p = strrchr(mydir, '/')))
mydir = p + 1; /* advance util last '/' */
if (strcmp(mydir, mypath) == 0) { /* fake a stat for ".." */
bzero(buf, sizeof(struct stat));
memset(buf, 0, sizeof(struct stat));
buf->st_mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH;
memcpy(&single_entry->my_stat, buf, sizeof(struct stat));
g_free(mdp);
@ -1400,7 +1400,7 @@ get_stat_info (smbfs_connection *sc, char *path, struct stat *buf)
return -1;
}
if (strcmp(mypath, dnp) == 0) {
bzero(buf, sizeof(struct stat));
memset(buf, 0, sizeof(struct stat));
buf->st_mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH;
memcpy(&single_entry->my_stat, buf, sizeof(struct stat));
DEBUG(1, (" CURRENT:found in %s\n", current_info->dirname));
@ -1522,7 +1522,7 @@ smbfs_stat (vfs *me, char *path, struct stat *buf)
if (strcmp(sp, pp) == 0) {
/* make server name appear as directory */
DEBUG(1, ("smbfs_stat: showing server as directory\n"));
bzero(buf, sizeof(struct stat));
memset(buf, 0, sizeof(struct stat));
buf->st_mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH;
return 0;
}

View File

@ -284,7 +284,7 @@ read_header (vfs *me, vfs_s_super *archive, int tard)
if (written > size)
written = size;
bcopy (data, bp, written);
memcpy (bp, data, written);
bp += written;
}
#if 0