From: Derrick Brashear Date: Wed, 8 Aug 2001 03:05:55 +0000 (+0000) Subject: convert-from-bsd-to-posix-string-and-memory-functions-20010807 X-Git-Tag: BP-openafs-stable-1_2_x~62 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=c5c521af0ed944a71f74a316bd51a81636ce2818 convert-from-bsd-to-posix-string-and-memory-functions-20010807 bcopy, bcmp, bzero, index, rindex, you're all cut. memcpy, memcmp, memset, strchr, strrchr, show us how it's done ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== fix reference to memset the right thing ==================== make change to arguments globally and not just for e.g. linux/darwin/fbsd ==================== fix a minor flub in how this was done ==================== correct another bad memcpy coversion ==================== fix up more inadvertant turds ==================== fix two errors found by chas williams --- diff --git a/src/WINNT/afsd/cm_callback.c b/src/WINNT/afsd/cm_callback.c index 2801464..f00938a 100644 --- a/src/WINNT/afsd/cm_callback.c +++ b/src/WINNT/afsd/cm_callback.c @@ -425,7 +425,7 @@ int SRXAFSCB_GetCellServDB( t_name = (char *)malloc(AFSNAMEMAX); t_name[0] = '\0'; *a_name = t_name; - bzero(a_hosts, AFSMAXCELLHOSTS * sizeof(afs_int32)); + memset(a_hosts, 0, AFSMAXCELLHOSTS * sizeof(afs_int32)); return 0; } diff --git a/src/WINNT/afsd/fs.c b/src/WINNT/afsd/fs.c index 985c444..1ad8aaf 100644 --- a/src/WINNT/afsd/fs.c +++ b/src/WINNT/afsd/fs.c @@ -2664,7 +2664,7 @@ static afs_int32 GetCryptCmd(as) if (code) Die(code, (char *) 0); else { tp = space; - bcopy(tp, &flag, sizeof(afs_int32)); + memcpy(&flag, tp, sizeof(afs_int32)); printf("Security level is currently "); if (flag == 1) printf("crypt (data security).\n"); diff --git a/src/WINNT/afsd/krb.h b/src/WINNT/afsd/krb.h index 6b24bb8..cf8f0dd 100644 --- a/src/WINNT/afsd/krb.h +++ b/src/WINNT/afsd/krb.h @@ -175,7 +175,7 @@ typedef struct ktext KTEXT_ST; swab(((char *) x) +10,((char *) _krb_swap_tmp) +4 ,2); \ swab(((char *) x) +12,((char *) _krb_swap_tmp) +2 ,2); \ swab(((char *) x) +14,((char *) _krb_swap_tmp) +0 ,2); \ - bcopy((char *)_krb_swap_tmp,(char *)x,16);\ + memcpy((char *)x, (char *)_krb_swap_tmp, 16);\ } #define swap_u_12(x) {\ @@ -186,7 +186,7 @@ typedef struct ktext KTEXT_ST; swab(((char *) x) +6, ((char *) _krb_swap_tmp) +4 ,2); \ swab(((char *) x) +8, ((char *) _krb_swap_tmp) +2 ,2); \ swab(((char *) x) +10,((char *) _krb_swap_tmp) +0 ,2); \ - bcopy((char *)_krb_swap_tmp,(char *)x,12);\ + memcpy((char *)x, (char *)_krb_swap_tmp, 12);\ } #define swap_C_Block(x) {\ @@ -195,7 +195,7 @@ typedef struct ktext KTEXT_ST; swab(((char *) x) +2,((char *) _krb_swap_tmp) +4 ,2); \ swab(((char *) x) +4,((char *) _krb_swap_tmp) +2 ,2); \ swab(((char *) x) +6,((char *) _krb_swap_tmp) ,2); \ - bcopy((char *)_krb_swap_tmp,(char *)x,8);\ + memcpy((char *)x, (char *)_krb_swap_tmp, 8);\ } #define swap_u_quad(x) {\ unsigned long _krb_swap_tmp[4];\ @@ -203,7 +203,7 @@ typedef struct ktext KTEXT_ST; swab(((char *) &x) +2,((char *) _krb_swap_tmp) +4 ,2); \ swab(((char *) &x) +4,((char *) _krb_swap_tmp) +2 ,2); \ swab(((char *) &x) +6,((char *) _krb_swap_tmp) ,2); \ - bcopy((char *)_krb_swap_tmp,(char *)&x,8);\ + memcpy((char *)&x, (char *)_krb_swap_tmp, 8);\ } #define swap_u_long(x) {\ diff --git a/src/afs/AIX/osi_file.c b/src/afs/AIX/osi_file.c index d1b77c9..8534d55 100644 --- a/src/afs/AIX/osi_file.c +++ b/src/afs/AIX/osi_file.c @@ -40,7 +40,7 @@ void *osi_UFSOpen(ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); crhold(&afs_osi_cred); /* don't let it evaporate, since it is static */ afs_osicred_initialized = 1; } diff --git a/src/afs/AIX/osi_timeout.c b/src/afs/AIX/osi_timeout.c index 8d92599..af976a0 100644 --- a/src/afs/AIX/osi_timeout.c +++ b/src/afs/AIX/osi_timeout.c @@ -233,7 +233,7 @@ int timeoutcf( break; } else { - bzero(tos, sizeof(struct tos)); + memset(tos, 0, sizeof(struct tos)); } /* The trb and the tos were both allocated. */ diff --git a/src/afs/AIX/osi_vnodeops.c b/src/afs/AIX/osi_vnodeops.c index c3c9d95..83e82d3 100644 --- a/src/afs/AIX/osi_vnodeops.c +++ b/src/afs/AIX/osi_vnodeops.c @@ -735,7 +735,7 @@ struct ucred *cred; AFS_STATCNT(afs_gn_fclear); if (!fclear_init) { - bzero(zero_buffer, PAGESIZE); + memset(zero_buffer, 0, PAGESIZE); fclear_init = 1; } /* diff --git a/src/afs/DARWIN/osi_file.c b/src/afs/DARWIN/osi_file.c index ee36eb6..943ea5c 100644 --- a/src/afs/DARWIN/osi_file.c +++ b/src/afs/DARWIN/osi_file.c @@ -106,7 +106,7 @@ void *osi_UFSOpen(ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); afs_osi_cred.cr_ref++; afs_osi_cred.cr_ngroups=1; afs_osicred_initialized = 1; diff --git a/src/afs/DARWIN/osi_module.c b/src/afs/DARWIN/osi_module.c index 8368c5a..322a46b 100644 --- a/src/afs/DARWIN/osi_module.c +++ b/src/afs/DARWIN/osi_module.c @@ -23,7 +23,7 @@ kern_return_t afs_modload(struct kmod_info *ki, void *data) printf("AFS_SYSCALL in use. aborting\n"); return KERN_FAILURE; } - bzero(&afs_vfsconf, sizeof(struct vfsconf)); + memset(&afs_vfsconf, 0, sizeof(struct vfsconf)); strcpy(afs_vfsconf.vfc_name, "afs"); afs_vfsconf.vfc_vfsops=&afs_vfsops; afs_vfsconf.vfc_typenum=VT_AFS; diff --git a/src/afs/DARWIN/osi_vfsops.c b/src/afs/DARWIN/osi_vfsops.c index 9acefcf..8f61253 100644 --- a/src/afs/DARWIN/osi_vfsops.c +++ b/src/afs/DARWIN/osi_vfsops.c @@ -78,8 +78,8 @@ struct proc *p; mp->mnt_stat.f_iosize=8192; (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN-1, &size); - bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); - bzero(mp->mnt_stat.f_mntfromname, MNAMELEN); + memset(mp->mnt_stat.f_mntonname + size, 0, MNAMELEN - size); + memset(mp->mnt_stat.f_mntfromname, 0, MNAMELEN); strcpy(mp->mnt_stat.f_mntfromname, "AFS"); /* null terminated string "AFS" will fit, just leave it be. */ strcpy(mp->mnt_stat.f_fstypename, "afs"); @@ -191,10 +191,8 @@ int afs_statfs(struct mount *mp, struct statfs *abp, struct proc *p) abp->f_fsid.val[1] = mp->mnt_stat.f_fsid.val[1]; if (abp != &mp->mnt_stat) { abp->f_type = mp->mnt_vfc->vfc_typenum; - bcopy((caddr_t)mp->mnt_stat.f_mntonname, - (caddr_t)&abp->f_mntonname[0], MNAMELEN); - bcopy((caddr_t)mp->mnt_stat.f_mntfromname, - (caddr_t)&abp->f_mntfromname[0], MNAMELEN); + memcpy((caddr_t)&abp->f_mntonname[0], (caddr_t)mp->mnt_stat.f_mntonname, MNAMELEN); + memcpy((caddr_t)&abp->f_mntfromname[0], (caddr_t)mp->mnt_stat.f_mntfromname, MNAMELEN); } AFS_GUNLOCK(); @@ -227,7 +225,7 @@ int afs_init(struct vfsconf *vfc) { MALLOC(afs_vnodeop_p, PFI *, vfs_opv_numops*sizeof(PFI), M_TEMP, M_WAITOK); - bzero (afs_vnodeop_p, vfs_opv_numops*sizeof(PFI)); + memset(afs_vnodeop_p, 0, vfs_opv_numops*sizeof(PFI)); opv_desc_vector = afs_vnodeop_p; for (j=0; afs_vnodeop_opv_desc.opv_desc_ops[j].opve_op; j++) { diff --git a/src/afs/DARWIN/osi_vnodeops.c b/src/afs/DARWIN/osi_vnodeops.c index 3e2932d..8401e97 100644 --- a/src/afs/DARWIN/osi_vnodeops.c +++ b/src/afs/DARWIN/osi_vnodeops.c @@ -121,7 +121,7 @@ struct vnodeopv_desc afs_vnodeop_opv_desc = struct componentname *cnp = ap->a_cnp; \ char *name; \ MALLOC(name, char *, cnp->cn_namelen+1, M_TEMP, M_WAITOK); \ - bcopy(cnp->cn_nameptr, name, cnp->cn_namelen); \ + memcpy(name, cnp->cn_nameptr, cnp->cn_namelen); \ name[cnp->cn_namelen] = '\0' #define DROPNAME() FREE(name, M_TEMP) @@ -604,7 +604,7 @@ afs_vop_pageout(ap) if ((f_offset < tvc->m.Length) && (f_offset + size) > tvc->m.Length) { size_t io = tvc->m.Length - f_offset; - bzero((caddr_t)(ioaddr + pl_offset + io), size - io); + memset((caddr_t)(ioaddr + pl_offset + io), 0, size - io); } } #endif /* ] USV */ @@ -888,10 +888,10 @@ abortit: goto abortit; MALLOC(fname, char *, fcnp->cn_namelen+1, M_TEMP, M_WAITOK); - bcopy(fcnp->cn_nameptr, fname, fcnp->cn_namelen); + memcpy(fname, fcnp->cn_nameptr, fcnp->cn_namelen); fname[fcnp->cn_namelen] = '\0'; MALLOC(tname, char *, tcnp->cn_namelen+1, M_TEMP, M_WAITOK); - bcopy(tcnp->cn_nameptr, tname, tcnp->cn_namelen); + memcpy(tname, tcnp->cn_nameptr, tcnp->cn_namelen); tname[tcnp->cn_namelen] = '\0'; diff --git a/src/afs/DUX/osi_file.c b/src/afs/DUX/osi_file.c index 3186fdf..918a4f0 100644 --- a/src/afs/DUX/osi_file.c +++ b/src/afs/DUX/osi_file.c @@ -60,7 +60,7 @@ void *osi_UFSOpen(ainode) struct utask_nd utnd = { NULL, NULL }; struct vattr attr; - bzero(&nd, sizeof(nd)); + memset(&nd, 0, sizeof(nd)); ndp->ni_utnd = &utnd; ndp->ni_nameiop = LOOKUP; ndp->ni_cred = &afs_osi_cred; diff --git a/src/afs/DUX/osi_vfsops.c b/src/afs/DUX/osi_vfsops.c index 2504e3d..ccdd2aa 100644 --- a/src/afs/DUX/osi_vfsops.c +++ b/src/afs/DUX/osi_vfsops.c @@ -90,10 +90,10 @@ int mp_afs_mount(struct mount *afsp,char * path, caddr_t data, if ( !afsp->m_stat.f_mntonname || !afsp->m_stat.f_mntfromname) panic("malloc failure in afs_mount\n"); - bzero(afsp->m_stat.f_mntonname, MNAMELEN); - bzero(afsp->m_stat.f_mntfromname, MNAMELEN); + memset(afsp->m_stat.f_mntonname, 0, MNAMELEN); + memset(afsp->m_stat.f_mntfromname, 0, MNAMELEN); AFS_COPYINSTR(path, (caddr_t)afsp->m_stat.f_mntonname, MNAMELEN, &size, code); - bcopy("AFS", afsp->m_stat.f_mntfromname, 4); + memcpy(afsp->m_stat.f_mntfromname, "AFS", 4); AFS_GUNLOCK(); (void) mp_afs_statfs(afsp); AFS_GLOCK(); @@ -307,12 +307,12 @@ int mp_afs_vptofh(struct vnode *avn, struct fid *fidp) fidp->fid_len = AFS_SIZEOFSMALLFID; if (afs_NFSRootOnly) { if (rootvp) { - bcopy((caddr_t)&Sfid, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)&Sfid, AFS_FIDDATASIZE); } else { - bcopy((caddr_t)addr, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)addr, AFS_FIDDATASIZE); } } else { - bcopy((caddr_t)&Sfid, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)&Sfid, AFS_FIDDATASIZE); } AFS_GUNLOCK(); return 0; diff --git a/src/afs/FBSD/osi_file.c b/src/afs/FBSD/osi_file.c index 537636f..26e4b7c 100644 --- a/src/afs/FBSD/osi_file.c +++ b/src/afs/FBSD/osi_file.c @@ -38,7 +38,7 @@ void *osi_UFSOpen(ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); afs_osi_cred.cr_ref++; afs_osicred_initialized = 1; } diff --git a/src/afs/FBSD/osi_vfsops.c b/src/afs/FBSD/osi_vfsops.c index 193e2bd..3ab83bb 100644 --- a/src/afs/FBSD/osi_vfsops.c +++ b/src/afs/FBSD/osi_vfsops.c @@ -90,10 +90,10 @@ int mp_afs_mount(struct mount *afsp,char * path, caddr_t data, if ( !afsp->m_stat.f_mntonname || !afsp->m_stat.f_mntfromname) panic("malloc failure in afs_mount\n"); - bzero(afsp->m_stat.f_mntonname, MNAMELEN); - bzero(afsp->m_stat.f_mntfromname, MNAMELEN); + memset(afsp->m_stat.f_mntonname, 0, MNAMELEN); + memset(afsp->m_stat.f_mntfromname, 0, MNAMELEN); AFS_COPYINSTR(path, (caddr_t)afsp->m_stat.f_mntonname, MNAMELEN, &size, code); - bcopy("AFS", afsp->m_stat.f_mntfromname, 4); + memcpy(afsp->m_stat.f_mntfromname, "AFS", 4); AFS_GUNLOCK(); (void) mp_afs_statfs(afsp); AFS_GLOCK(); @@ -299,12 +299,12 @@ int mp_afs_vptofh(struct vnode *avn, struct fid *fidp) fidp->fid_len = AFS_SIZEOFSMALLFID; if (afs_NFSRootOnly) { if (rootvp) { - bcopy((caddr_t)&Sfid, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)&Sfid, AFS_FIDDATASIZE); } else { - bcopy((caddr_t)addr, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)addr, AFS_FIDDATASIZE); } } else { - bcopy((caddr_t)&Sfid, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)&Sfid, AFS_FIDDATASIZE); } AFS_GUNLOCK(); return 0; diff --git a/src/afs/HPUX/osi_file.c b/src/afs/HPUX/osi_file.c index 1f95ea0..70be511 100644 --- a/src/afs/HPUX/osi_file.c +++ b/src/afs/HPUX/osi_file.c @@ -39,7 +39,7 @@ void *osi_UFSOpen(ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); crhold(&afs_osi_cred); /* don't let it evaporate, since it is static */ afs_osicred_initialized = 1; } diff --git a/src/afs/HPUX/osi_vnodeops.c b/src/afs/HPUX/osi_vnodeops.c index 42d08b1..799a998 100644 --- a/src/afs/HPUX/osi_vnodeops.c +++ b/src/afs/HPUX/osi_vnodeops.c @@ -77,14 +77,14 @@ m_cpytoc(m, off, len, cp) return (len); ml = MIN(len, m->m_len - off); - bcopy(mtod(m, caddr_t)+off, cp, (u_int)ml); + memcpy(cp, mtod(m, caddr_t)+off, (u_int)ml); cp += ml; len -= ml; m = m->m_next; while (len && m) { ml = m->m_len; - bcopy(mtod(m, caddr_t), cp, (u_int)ml); + memcpy(cp, mtod(m, caddr_t), (u_int)ml); cp += ml; len -= ml; m = m->m_next; @@ -1350,7 +1350,7 @@ afs_pageout(vp,prp, start, end, flags) filevp = VM_GET_PAGEOUT_VNODE(&vm_info); /* always page out to back store */ VASSERT(filevp != NULL); - bzero((caddr_t)&args, sizeof(fsdata_t)); + memset((caddr_t)&args, 0, sizeof(fsdata_t)); args.remote_down = 0; /* assume remote file servers are up */ args.remote = 1; /* we are remote */ args.bsize = 0; /* filled up later by afs_vm_checkpage() */ @@ -2039,7 +2039,7 @@ afs_readdir(vp, uiop, cred) if ((caddr_t) odp + odp->d_reclen > obufend) break; /* record offset *after* we're sure to use this entry */ - bcopy((char *)&idp->__d_off, (char *)&tmp_offset, sizeof tmp_offset); + memcpy((char *)&tmp_offset, (char *)&idp->__d_off, sizeof tmp_offset); offset = tmp_offset; } @@ -2098,7 +2098,7 @@ afs_readdir3(vp, uiop, cred) (caddr_t)idp < ibufend; idp = (struct __dirent32 *) ((caddr_t) idp + idp->__d_reclen), odp = (struct __dirent64 *) ((caddr_t) odp + odp->__d_reclen)) { - bcopy((char *)&idp->__d_off, (char *)&odp->__d_off, sizeof odp->__d_off); + memcpy((char *)&odp->__d_off, (char *)&idp->__d_off, sizeof odp->__d_off); odp->__d_ino = idp->__d_ino; odp->__d_namlen = idp->__d_namlen; (void) strcpy(odp->__d_name, idp->__d_name); @@ -2223,7 +2223,7 @@ printf("afsHash: enter\n"); osi_Panic("afs: cannot create SEMA Hashtable\n"); /* initialize the hash table and associated locks */ - bzero((char *)hashTable, sizeOfHashTable * sizeof(Bucket )); + memset((char *)hashTable, 0, sizeOfHashTable * sizeof(Bucket )); for ( i=0;i < sizeOfHashTable; i ++) hashLockInit( hashTable[i].lock); hashLockInit(afsHashLock); @@ -2289,7 +2289,7 @@ printf("afsHashInsertFind: %d FOUND\n", key); osi_Panic("afs: SEMA Hashtable cannot create new entry\n"); /* create new entry */ ptr->key = key; - bzero((char *)&ptr->element, sizeof(ptr->element)); + memset((char *)&ptr->element, 0, sizeof(ptr->element)); ptr->refCnt = 1; /* this guy */ /* insert new entry in bucket */ diff --git a/src/afs/IRIX/osi_file.c b/src/afs/IRIX/osi_file.c index 1c40fa0..d594f22 100644 --- a/src/afs/IRIX/osi_file.c +++ b/src/afs/IRIX/osi_file.c @@ -74,7 +74,7 @@ void *osi_UFSOpen(ino_t ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); crhold(&afs_osi_cred); /* don't let it evaporate, since it is static */ afs_osicred_initialized = 1; } diff --git a/src/afs/IRIX/osi_groups.c b/src/afs/IRIX/osi_groups.c index 9db45de..213e30e 100644 --- a/src/afs/IRIX/osi_groups.c +++ b/src/afs/IRIX/osi_groups.c @@ -89,7 +89,7 @@ int fixup_pags(int **credpp, int ngroups, gid_t *gidset, int old_afs_pag, return EINVAL; /* sorry */ cr = crdup(OSI_GET_CURRENT_CRED()); /* we will replace all the groups. */ - bzero((char*)&cr->cr_groups, ngroups_max * sizeof(gid_t)); + memset((char*)&cr->cr_groups, 0, ngroups_max * sizeof(gid_t)); /* Now cobble the new groups list together. */ new = 0; diff --git a/src/afs/IRIX/osi_inode.c b/src/afs/IRIX/osi_inode.c index e9c6707..2e4778f 100644 --- a/src/afs/IRIX/osi_inode.c +++ b/src/afs/IRIX/osi_inode.c @@ -460,7 +460,7 @@ xfs_icreatename64(struct vfs *vfsp, int datap, int datalen, } else createdDir = 1; - bzero((char*)&dattr, sizeof(dattr)); + memset((char*)&dattr, 0, sizeof(dattr)); dattr.atd_version = AFS_XFS_ATD_VERS; dattr.atd_volume = rw_vno; AFS_VOP_ATTR_SET(dvp, AFS_XFS_DATTR, (char*)&dattr, @@ -482,7 +482,7 @@ xfs_icreatename64(struct vfs *vfsp, int datap, int datalen, return code; } - bzero((char*)&attrs, sizeof(attrs)); + memset((char*)&attrs, 0, sizeof(attrs)); attrs.at_pino = vattr.va_nodeid; VN_RELE(dvp); @@ -510,8 +510,7 @@ xfs_icreatename64(struct vfs *vfsp, int datap, int datalen, if (!code) { /* Set attributes. */ - bcopy((char*)params, (char*)attrs.at_param, - sizeof(afs_inode_params_t)); + memcpy((char*)attrs.at_param, (char*)params, sizeof(afs_inode_params_t)); attrs.at_attr_version = AFS_XFS_ATTR_VERS; attrs.at_name_version = name_version; AFS_VOP_ATTR_SET(vp, AFS_XFS_ATTR, (char*)&attrs, @@ -1200,12 +1199,11 @@ afs_syscall_ilistinode64(int dev, int inode_hi, int inode_lo, } if (!code) { - bzero((char*)&data, sizeof(data)); + memset((char*)&data, 0, sizeof(data)); data.ili_info.inodeNumber = inode; data.ili_info.byteCount = vattr.va_size; data.ili_info.linkCount = (vattr.va_mode & AFS_XFS_MODE_LINK_MASK); - bcopy((char*)attrs.at_param, (char*)data.ili_info.param, - sizeof(data.ili_info.param)); + memcpy((char*)data.ili_info.param, (char*)attrs.at_param, sizeof(data.ili_info.param)); data.ili_attr_version = attrs.at_attr_version; data.ili_name_version = attrs.at_name_version; data.ili_tag = attrs.at_tag; diff --git a/src/afs/IRIX/osi_vnodeops.c b/src/afs/IRIX/osi_vnodeops.c index 1f04077..0952e99 100644 --- a/src/afs/IRIX/osi_vnodeops.c +++ b/src/afs/IRIX/osi_vnodeops.c @@ -810,7 +810,7 @@ afs_strategy(OSI_VC_ARG(avc), bp) /* we are responsible for zero'ing the page */ caddr_t c; c = bp_mapin(bp); - bzero(c, bp->b_bcount); + memset(c, 0, bp->b_bcount); iodone(bp); ReleaseReadLock(&avc->lock); return; diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c index 0bdb103..3eef98f 100644 --- a/src/afs/LINUX/osi_file.c +++ b/src/afs/LINUX/osi_file.c @@ -40,7 +40,7 @@ void *osi_UFSOpen(ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); crhold(&afs_osi_cred); /* don't let it evaporate, since it is static */ afs_osicred_initialized = 1; } diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 22fa1dd..96422d9 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -59,9 +59,11 @@ extern struct vnodeops afs_dir_iops, afs_symlink_iops; ((vc)->v_op == &afs_dir_iops) ? 1 : \ ((vc)->v_op == &afs_symlink_iops)) -/* bcopy is in stds.h, just so fcrpyt.c can pick it up. */ +#if 0 +/* bcopy is in stds.h, just so fcrypt.c can pick it up. */ #define bzero(D,C) memset((D), 0, (C)) #define bcmp(A,B,C) memcmp((A), (B), (C)) +#endif /* We often need to pretend we're in user space to get memory transfers * right for the kernel calls we use. diff --git a/src/afs/SOLARIS/osi_file.c b/src/afs/SOLARIS/osi_file.c index 3970760..068c1a7 100644 --- a/src/afs/SOLARIS/osi_file.c +++ b/src/afs/SOLARIS/osi_file.c @@ -189,7 +189,7 @@ void *osi_UFSOpen(ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); crhold(&afs_osi_cred); /* don't let it evaporate, since it is static */ afs_osicred_initialized = 1; } diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index 18b714c..c64484d 100644 --- a/src/afs/UKERNEL/afs_usrops.c +++ b/src/afs/UKERNEL/afs_usrops.c @@ -1419,7 +1419,7 @@ struct afsconf_dir *adir; { /* build address list */ for(i=0;ihostAddr[i].sin_addr, &hosts[i], sizeof(afs_int32)); + memcpy(&hosts[i], &aci->hostAddr[i].sin_addr, sizeof(afs_int32)); if (aci->linkedCell) cellFlags |= 4; /* Flag that linkedCell arg exists, for upwards compatibility */ @@ -1649,7 +1649,7 @@ void uafs_Init( rn, cacheFiles); exit(1); } - bzero(pathname_for_V, (cacheFiles * sizeof(char *))); + memset(pathname_for_V, 0, (cacheFiles * sizeof(char *))); if (afsd_debug) printf("%s: %d pathname_for_V entries at 0x%x, %d bytes\n", rn, cacheFiles, (cacheFiles * sizeof(AFSD_INO_T))); @@ -1747,7 +1747,7 @@ void uafs_Init( " flags = 0x%x, dcache entries %d\n", rn, cacheStatEntries, cacheFiles, cacheBlocks, cacheFlags, dCacheSize); - bzero(&cparams, sizeof(cparams)); + memset(&cparams, 0, sizeof(cparams)); cparams.cacheScaches = cacheStatEntries; cparams.cacheFiles = cacheFiles; cparams.cacheBlocks = cacheBlocks; diff --git a/src/afs/VNOPS/afs_vnop_fid.c b/src/afs/VNOPS/afs_vnop_fid.c index 38c584a..74f2536 100644 --- a/src/afs/VNOPS/afs_vnop_fid.c +++ b/src/afs/VNOPS/afs_vnop_fid.c @@ -130,12 +130,12 @@ struct fid **fidpp; || USE_SMALLFID(credp) #endif ) { - bcopy((caddr_t)&Sfid, fidpp->fid_data, SizeOfSmallFid); + memcpy(fidpp->fid_data, (caddr_t)&Sfid, SizeOfSmallFid); } else { - bcopy((caddr_t)addr, fidpp->fid_data, SizeOfSmallFid); + memcpy(fidpp->fid_data, (caddr_t)addr, SizeOfSmallFid); } } else { - bcopy((caddr_t)&Sfid, fidpp->fid_data, SizeOfSmallFid); + memcpy(fidpp->fid_data, (caddr_t)&Sfid, SizeOfSmallFid); } #else /* malloc a fid pointer ourselves. */ @@ -143,12 +143,12 @@ struct fid **fidpp; (*fidpp)->fid_len = SizeOfSmallFid; if (afs_NFSRootOnly) { if (rootvp) { - bcopy((char *)&Sfid, (*fidpp)->fid_data, SizeOfSmallFid); + memcpy((*fidpp)->fid_data, (char *)&Sfid, SizeOfSmallFid); } else { - bcopy((char *)addr, (*fidpp)->fid_data, SizeOfSmallFid); + memcpy((*fidpp)->fid_data, (char *)addr, SizeOfSmallFid); } } else { - bcopy((char *)&Sfid, (*fidpp)->fid_data, SizeOfSmallFid); + memcpy((*fidpp)->fid_data, (char *)&Sfid, SizeOfSmallFid); } #endif return (0); diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 03379a8..06b75f6 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -562,8 +562,7 @@ tagain: * preserve the value of the file size. We could * flush the pages, but it wouldn't be worthwhile. */ - bcopy((char *) &tfid.Fid, (char *)(fidsp+fidIndex), - sizeof(*fidsp)); + memcpy((char *)(fidsp+fidIndex), (char *) &tfid.Fid, sizeof(*fidsp)); tvcp->states |= CBulkFetching; tvcp->m.Length = statSeqNo; fidIndex++; @@ -897,7 +896,7 @@ afs_lookup(adp, aname, avcp, acred) AFS_STATCNT(afs_lookup); #ifdef AFS_OSF_ENV ndp->ni_dvp = (struct vnode *)adp; - bcopy(ndp->ni_ptr, aname, ndp->ni_namelen); + memcpy(aname, ndp->ni_ptr, ndp->ni_namelen); aname[ndp->ni_namelen] = '\0'; #endif /* AFS_OSF_ENV */ diff --git a/src/afs/VNOPS/afs_vnop_strategy.c b/src/afs/VNOPS/afs_vnop_strategy.c index 7c1f54b..53ab959 100644 --- a/src/afs/VNOPS/afs_vnop_strategy.c +++ b/src/afs/VNOPS/afs_vnop_strategy.c @@ -104,9 +104,9 @@ afs_ustrategy(abp) if (code == 0) { if (tuio.afsio_resid > 0) #if defined(AFS_FBSD_ENV) - bzero(abp->b_saveaddr + abp->b_bcount - tuio.afsio_resid, tuio.afsio_resid); + memset(abp->b_saveaddr + abp->b_bcount - tuio.afsio_resid, 0, tuio.afsio_resid); #else - bzero(abp->b_un.b_addr + abp->b_bcount - tuio.afsio_resid, tuio.afsio_resid); + memset(abp->b_un.b_addr + abp->b_bcount - tuio.afsio_resid, 0, tuio.afsio_resid); #endif /* AFS_FBSD_ENV */ #ifdef AFS_AIX32_ENV /* diff --git a/src/afs/afs_buffer.c b/src/afs/afs_buffer.c index 45d2956..8f019ba 100644 --- a/src/afs/afs_buffer.c +++ b/src/afs/afs_buffer.c @@ -536,6 +536,6 @@ void shutdown_bufferpackage() { nbuffers = 0; timecounter = 1; for(i=0;irefCount = 1; logp->name = osi_AllocSmallSpace(strlen(name)+1); @@ -2028,8 +2028,7 @@ afs_icl_CopyOut(logp, bufferp, bufSizep, cookiep, flagsp) if (end - ix < nwords) nwords = end - ix; if (nwords > 0) { - bcopy((char *) &logp->datap[ix], (char *) bufferp, - sizeof(afs_int32) * nwords); + memcpy((char *) bufferp, (char *) &logp->datap[ix], sizeof(afs_int32) * nwords); outWords += nwords; inWords -= nwords; bufferp += nwords; @@ -2049,8 +2048,7 @@ afs_icl_CopyOut(logp, bufferp, bufSizep, cookiep, flagsp) nwords = inWords; if (logp->firstFree - ix < nwords) nwords = logp->firstFree - ix; - bcopy((char *) &logp->datap[ix], (char *) bufferp, - sizeof(afs_int32) * nwords); + memcpy((char *) bufferp, (char *) &logp->datap[ix], sizeof(afs_int32) * nwords); outWords += nwords; inWords -= nwords; bufferp += nwords; @@ -2330,7 +2328,7 @@ afs_icl_CreateSetWithFlags(name, baseLogp, fatalLogp, flags, outSetpp) states |= ICL_SETF_PERSISTENT; setp = (struct afs_icl_set *) afs_osi_Alloc(sizeof(struct afs_icl_set)); - bzero((caddr_t)setp, sizeof(*setp)); + memset((caddr_t)setp, 0, sizeof(*setp)); setp->refCount = 1; if (states & ICL_SETF_FREED) states &= ~ICL_SETF_ACTIVE; /* if freed, can't be active */ diff --git a/src/afs/afs_callback.c b/src/afs/afs_callback.c index 55880de..bcc1e54 100644 --- a/src/afs/afs_callback.c +++ b/src/afs/afs_callback.c @@ -719,7 +719,7 @@ int SRXAFSCB_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVers */ dataBytes = sizeof(struct afs_CMStats); dataBuffP = (afs_int32 *)afs_osi_Alloc(dataBytes); - bcopy((char *)&afs_cmstats, (char *)dataBuffP, dataBytes); + memcpy((char *)dataBuffP, (char *)&afs_cmstats, dataBytes); a_dataP->AFSCB_CollData_len = dataBytes>>2; a_dataP->AFSCB_CollData_val = dataBuffP; break; @@ -739,7 +739,7 @@ int SRXAFSCB_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVers afs_CountServers(); dataBytes = sizeof(afs_stats_cmperf); dataBuffP = (afs_int32 *)afs_osi_Alloc(dataBytes); - bcopy((char *)&afs_stats_cmperf, (char *)dataBuffP, dataBytes); + memcpy((char *)dataBuffP, (char *)&afs_stats_cmperf, dataBytes); a_dataP->AFSCB_CollData_len = dataBytes>>2; a_dataP->AFSCB_CollData_val = dataBuffP; break; @@ -757,14 +757,12 @@ int SRXAFSCB_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVers */ afs_stats_cmperf.numPerfCalls++; afs_CountServers(); - bcopy((char *)(&afs_stats_cmperf), - (char *)(&(afs_stats_cmfullperf.perf)), - sizeof(struct afs_stats_CMPerf)); + memcpy((char *)(&(afs_stats_cmfullperf.perf)), (char *)(&afs_stats_cmperf), sizeof(struct afs_stats_CMPerf)); afs_stats_cmfullperf.numFullPerfCalls++; dataBytes = sizeof(afs_stats_cmfullperf); dataBuffP = (afs_int32 *)afs_osi_Alloc(dataBytes); - bcopy((char *)(&afs_stats_cmfullperf), (char *)dataBuffP, dataBytes); + memcpy((char *)dataBuffP, (char *)(&afs_stats_cmfullperf), dataBytes); a_dataP->AFSCB_CollData_len = dataBytes>>2; a_dataP->AFSCB_CollData_val = dataBuffP; break; @@ -1142,7 +1140,7 @@ int SRXAFSCB_GetCellServDB( } t_name[0] = '\0'; - bzero(a_hosts, AFSMAXCELLHOSTS * sizeof(afs_int32)); + memset(a_hosts, 0, AFSMAXCELLHOSTS * sizeof(afs_int32)); /* search the list for the cell with this index */ ObtainReadLock(&afs_xcell); diff --git a/src/afs/afs_cbqueue.c b/src/afs/afs_cbqueue.c index cdb0986..eb9c970 100644 --- a/src/afs/afs_cbqueue.c +++ b/src/afs/afs_cbqueue.c @@ -367,7 +367,7 @@ int doLockInit; { register int i; -bzero((char *)cbHashT, CBHTSIZE*sizeof(struct bucket)); +memset((char *)cbHashT, 0, CBHTSIZE*sizeof(struct bucket)); for (i=0;istates |= aflags; tc->timeout = timeout; - bzero((char *)tc->cellHosts, sizeof(tc->cellHosts)); + memset((char *)tc->cellHosts, 0, sizeof(tc->cellHosts)); for (i=0; iuser = tu; tc->port = aport; diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index 3e8ebfe..18cda8f 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -1079,7 +1079,7 @@ afs_BioDaemon (nbiods) /* Initialize a token (self) to use in the queue of sleeping processes. */ self = (struct afs_bioqueue *) afs_osi_Alloc (sizeof (struct afs_bioqueue)); pin (self, sizeof (struct afs_bioqueue)); /* fix in memory */ - bzero(self, sizeof(*self)); + memset(self, 0, sizeof(*self)); QInit (&(self->lruq)); /* initialize queue entry pointers */ @@ -1200,7 +1200,7 @@ void afs_BackgroundDaemon() { /* initialize subsystem */ if (brsInit == 0) { LOCK_INIT(&afs_xbrs, "afs_xbrs"); - bzero((char *)afs_brs, sizeof(afs_brs)); + memset((char *)afs_brs, 0, sizeof(afs_brs)); brsInit = 1; #if defined (AFS_SGI_ENV) && defined(AFS_SGI_SHORTSTACK) /* @@ -1281,8 +1281,8 @@ void shutdown_daemons() if (afs_cold_shutdown) { afs_brsDaemons = brsInit = 0; rxepoch_checked = afs_nbrs = 0; - bzero((char *)afs_brs, sizeof(afs_brs)); - bzero((char *)&afs_xbrs, sizeof(afs_lock_t)); + memset((char *)afs_brs, 0, sizeof(afs_brs)); + memset((char *)&afs_xbrs, 0, sizeof(afs_lock_t)); afs_brsWaiters = 0; #ifdef AFS_AIX32_ENV #ifdef AFS_AIX41_ENV @@ -1292,7 +1292,7 @@ void shutdown_daemons() #else /* AFS_AIX41_ENV */ afs_busyq = NULL; afs_biodcnt = 0; - bzero((char *)&afs_bioqueue, sizeof(struct afs_bioqueue)); + memset((char *)&afs_bioqueue, 0, sizeof(struct afs_bioqueue)); #endif afs_initbiod = 0; #endif diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 1f14860..f2c0459 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -2650,18 +2650,18 @@ void afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk, /* Allocate and zero the pointer array to the dcache entries */ afs_indexTable = (struct dcache **) afs_osi_Alloc(sizeof(struct dcache *) * afiles); - bzero((char *)afs_indexTable, sizeof(struct dcache *) * afiles); + memset((char *)afs_indexTable, 0, sizeof(struct dcache *) * afiles); afs_indexTimes = (afs_hyper_t *) afs_osi_Alloc(afiles * sizeof(afs_hyper_t)); - bzero((char *)afs_indexTimes, afiles * sizeof(afs_hyper_t)); + memset((char *)afs_indexTimes, 0, afiles * sizeof(afs_hyper_t)); afs_indexUnique = (afs_int32 *) afs_osi_Alloc(afiles * sizeof(afs_uint32)); - bzero((char *)afs_indexUnique, afiles * sizeof(afs_uint32)); + memset((char *)afs_indexUnique, 0, afiles * sizeof(afs_uint32)); afs_indexFlags = (u_char *) afs_osi_Alloc(afiles * sizeof(u_char)); - bzero((char *)afs_indexFlags, afiles * sizeof(char)); + memset((char *)afs_indexFlags, 0, afiles * sizeof(char)); /* Allocate and thread the struct dcache entries themselves */ tdp = afs_Initial_freeDSList = (struct dcache *) afs_osi_Alloc(aDentries * sizeof(struct dcache)); - bzero((char *)tdp, aDentries * sizeof(struct dcache)); + memset((char *)tdp, 0, aDentries * sizeof(struct dcache)); #ifdef AFS_AIX32_ENV pin((char *)afs_indexTable, sizeof(struct dcache *) * afiles);/* XXX */ pin((char *)afs_indexTimes, sizeof(afs_hyper_t) * afiles); /* XXX */ diff --git a/src/afs/afs_exporter.c b/src/afs/afs_exporter.c index 9ad9d05..77bb8a6 100644 --- a/src/afs/afs_exporter.c +++ b/src/afs/afs_exporter.c @@ -37,7 +37,7 @@ char *data; } length = (size ? size : sizeof(struct afs_exporter)); ex = (struct afs_exporter *) afs_osi_Alloc(length); - bzero((char *)ex, length); + memset((char *)ex, 0, length); MObtainWriteLock(&afs_xexp,308); for (op = root_exported; op; op = op->exp_next) { if (!op->exp_next) diff --git a/src/afs/afs_init.c b/src/afs/afs_init.c index 129b699..f5b95b8 100644 --- a/src/afs/afs_init.c +++ b/src/afs/afs_init.c @@ -695,8 +695,8 @@ shutdown_cache() cacheInfoModTime = 0; afs_fsfragsize = 1023; - bzero((char *)&afs_stats_cmperf, sizeof(afs_stats_cmperf)); - bzero((char *)&cacheDev, sizeof(struct osi_dev)); + memset((char *)&afs_stats_cmperf, 0, sizeof(afs_stats_cmperf)); + memset((char *)&cacheDev, 0, sizeof(struct osi_dev)); osi_dnlc_shutdown(); } } /*shutdown_cache*/ @@ -860,7 +860,7 @@ void shutdown_AFS() afs_FVIndex = -1; afs_server = (struct rx_service *)0; RWLOCK_INIT(&afs_xconn, "afs_xconn"); - bzero((char *)&afs_rootFid, sizeof(struct VenusFid)); + memset((char *)&afs_rootFid, 0, sizeof(struct VenusFid)); RWLOCK_INIT(&afs_xuser, "afs_xuser"); RWLOCK_INIT(&afs_xvolume, "afs_xvolume"), RWLOCK_INIT(&afs_xcell, "afs_xcell"); RWLOCK_INIT(&afs_xserver, "afs_xserver"), LOCK_INIT(&afs_puttofileLock, "afs_puttofileLock"); diff --git a/src/afs/afs_memcache.c b/src/afs/afs_memcache.c index 19eb348..f795110 100644 --- a/src/afs/afs_memcache.c +++ b/src/afs/afs_memcache.c @@ -73,7 +73,7 @@ afs_InitMemCache(size, blkSize, flags) if (blk == NULL) goto nomem; (memCache+index)->data = blk; - bzero((memCache+index)->data, memCacheBlkSize); + memset((memCache+index)->data, 0, memCacheBlkSize); } #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) afs_InitDualFSCacheOps((struct vnode*)0); @@ -132,7 +132,7 @@ afs_MemReadBlk(mceP, offset, dest, size) if(bytesRead > 0) { AFS_GUNLOCK(); - bcopy(mceP->data + offset, dest, bytesRead); + memcpy(dest, mceP->data + offset, bytesRead); AFS_GLOCK(); } else @@ -170,7 +170,7 @@ afs_MemReadvBlk(mceP, offset, iov, nio, size) for (i = 0 , size = bytesRead ; i < nio && size > 0 ; i++) { bytesToRead = (size < iov[i].iov_len) ? size : iov[i].iov_len; AFS_GUNLOCK(); - bcopy(mceP->data + offset, iov[i].iov_base, bytesToRead); + memcpy(iov[i].iov_base, mceP->data + offset, bytesToRead); AFS_GLOCK(); offset += bytesToRead; size -= bytesToRead; @@ -227,15 +227,15 @@ afs_MemWriteBlk(mceP, offset, src, size) /* may overlap, but this is OK */ AFS_GUNLOCK(); - bcopy(oldData, mceP->data, mceP->size); + memcpy(mceP->data, oldData, mceP->size); AFS_GLOCK(); afs_osi_Free(oldData,mceP->dataSize); mceP->dataSize = size+offset; } AFS_GUNLOCK(); if (mceP->size < offset) - bzero(mceP->data+mceP->size, offset-mceP->size); - bcopy(src, mceP->data + offset, size); + memset(mceP->data+mceP->size, 0, offset-mceP->size); + memcpy(mceP->data + offset, src, size); AFS_GLOCK(); mceP->size = (size+offset < mceP->size) ? mceP->size : size + offset; @@ -264,17 +264,17 @@ afs_MemWritevBlk(mceP, offset, iov, nio, size) /* may overlap, but this is OK */ AFS_GUNLOCK(); - bcopy(oldData, mceP->data, mceP->size); + memcpy(mceP->data, oldData, mceP->size); AFS_GLOCK(); afs_osi_Free(oldData,mceP->dataSize); mceP->dataSize = size+offset; } if (mceP->size < offset) - bzero(mceP->data+mceP->size, offset-mceP->size); + memset(mceP->data+mceP->size, 0, offset-mceP->size); for (bytesWritten = 0, i = 0 ; i < nio && size > 0 ; i++) { bytesToWrite = (size < iov[i].iov_len) ? size : iov[i].iov_len; AFS_GUNLOCK(); - bcopy(iov[i].iov_base, mceP->data + offset, bytesToWrite); + memcpy(mceP->data + offset, iov[i].iov_base, bytesToWrite); AFS_GLOCK(); offset += bytesToWrite; bytesWritten += bytesToWrite; @@ -301,14 +301,14 @@ afs_MemWriteUIO(blkno, uioP) mceP->data = afs_osi_Alloc(uioP->uio_resid + uioP->uio_offset); AFS_GUNLOCK(); - bcopy(oldData, mceP->data, mceP->size); + memcpy(mceP->data, oldData, mceP->size); AFS_GLOCK(); afs_osi_Free(oldData,mceP->dataSize); mceP->dataSize = uioP->uio_resid + uioP->uio_offset; } if (mceP->size < uioP->uio_offset) - bzero(mceP->data+mceP->size, (int)(uioP->uio_offset-mceP->size)); + memset(mceP->data+mceP->size, 0, (int)(uioP->uio_offset-mceP->size)); AFS_UIOMOVE(mceP->data+uioP->uio_offset, uioP->uio_resid, UIO_WRITE, uioP, code); if (uioP->uio_offset > mceP->size) mceP->size = uioP->uio_offset; diff --git a/src/afs/afs_nfsclnt.c b/src/afs/afs_nfsclnt.c index 950e80b..21f4042 100644 --- a/src/afs/afs_nfsclnt.c +++ b/src/afs/afs_nfsclnt.c @@ -72,9 +72,9 @@ register afs_int32 uid, host; } } np = (struct nfsclientpag *) afs_osi_Alloc(sizeof (struct nfsclientpag)); - bzero((char *)np, sizeof(struct nfsclientpag)); + memset((char *)np, 0, sizeof(struct nfsclientpag)); /* Copy the necessary afs_exporter fields */ - bcopy((char *)afs_nfsexporter, (char *)np, sizeof(struct afs_exporter)); + memcpy((char *)np, (char *)afs_nfsexporter, sizeof(struct afs_exporter)); np->next = afs_nfspags[i]; afs_nfspags[i] = np; np->uid = uid; diff --git a/src/afs/afs_osi.c b/src/afs/afs_osi.c index ed31fc1..159719a 100644 --- a/src/afs/afs_osi.c +++ b/src/afs/afs_osi.c @@ -72,7 +72,7 @@ void osi_Init() if ( !afs_osicred_initialized ) { - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); crhold(&afs_osi_cred); /* don't let it evaporate */ afs_osicred_initialized = 1; } @@ -935,7 +935,7 @@ const struct AFS_UCRED *afs_osi_proc2cred(AFS_PROC *pr) cr.cr_ref=1; cr.cr_uid=pr->p_cred->pc_ucred->cr_uid; cr.cr_ngroups=pr->p_cred->pc_ucred->cr_ngroups; - bcopy(pr->p_cred->pc_ucred->cr_groups, cr.cr_groups,NGROUPS * + memcpy(cr.cr_groups, pr->p_cred->pc_ucred->cr_groups, NGROUPS * sizeof(gid_t)); pcred_unlock(pr); rv = &cr; diff --git a/src/afs/afs_osi_uio.c b/src/afs/afs_osi_uio.c index 08cab45..878c7f0 100644 --- a/src/afs/afs_osi_uio.c +++ b/src/afs/afs_osi_uio.c @@ -33,11 +33,11 @@ register struct iovec *aoutvec; { AFS_STATCNT(afsio_copy); if (ainuio->afsio_iovcnt > AFS_MAXIOVCNT) return EINVAL; - bcopy((char *)ainuio, (char *)aoutuio, sizeof(struct uio)); + memcpy((char *)aoutuio, (char *)ainuio, sizeof(struct uio)); tvec = ainuio->afsio_iov; aoutuio->afsio_iov = aoutvec; for(i=0;iafsio_iovcnt;i++){ - bcopy((char *)tvec, (char *)aoutvec, sizeof(struct iovec)); + memcpy((char *)aoutvec, (char *)tvec, sizeof(struct iovec)); tvec++; /* too many compiler bugs to do this as one expr */ aoutvec++; } diff --git a/src/afs/afs_osi_vget.c b/src/afs/afs_osi_vget.c index 61cc899..94ab8d9 100644 --- a/src/afs/afs_osi_vget.c +++ b/src/afs/afs_osi_vget.c @@ -37,7 +37,7 @@ int afs_osi_vget(struct vcache **avcpp, struct fid *afidp, register afs_int32 code = 0, cellindex; afs_int32 ret; - bcopy(afidp->fid_data, (char *)&Sfid, SIZEOF_SMALLFID); + memcpy((char *)&Sfid, afidp->fid_data, SIZEOF_SMALLFID); #ifdef AFS_OSF_ENV Sfid.Vnode = afidp->fid_reserved; #endif diff --git a/src/afs/afs_osidnlc.c b/src/afs/afs_osidnlc.c index 97bc6c6..1631ec71 100644 --- a/src/afs/afs_osidnlc.c +++ b/src/afs/afs_osidnlc.c @@ -174,7 +174,7 @@ retry: tnc->dirp = adp; tnc->vp = avc; tnc->key = key; - bcopy (aname, (char *)tnc->name, ts-aname+1); /* include the NULL */ + memcpy((char *)tnc->name, aname, ts-aname+1); /* include the NULL */ InsertEntry(tnc); } else { @@ -446,8 +446,8 @@ int osi_dnlc_purge() } else { /* did get the lock */ ncfreelist = (struct nc *) 0; - bzero ((char *)nameCache, sizeof(struct nc) * NCSIZE); - bzero ((char *)nameHash, sizeof(struct nc *) * NHSIZE); + memset((char *)nameCache, 0, sizeof(struct nc) * NCSIZE); + memset((char *)nameHash, 0, sizeof(struct nc *) * NHSIZE); for (i=0; ifid, aout, sizeof(struct VenusFid)); + memcpy(aout, (char *)&avc->fid, sizeof(struct VenusFid)); *aoutSize = sizeof(struct VenusFid); return 0; } @@ -1387,23 +1387,23 @@ static PGCPAGs(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) if (!afs_resourceinit_flag) { return EIO; } - bcopy(ain, (char *)&i, sizeof(afs_int32)); + memcpy((char *)&i, ain, sizeof(afs_int32)); ain += sizeof(afs_int32); stp = ain; /* remember where the ticket is */ if (i < 0 || i > 2000) return EINVAL; /* malloc may fail */ stLen = i; ain += i; /* skip over ticket */ - bcopy(ain, (char *)&i, sizeof(afs_int32)); + memcpy((char *)&i, ain, sizeof(afs_int32)); ain += sizeof(afs_int32); if (i != sizeof(struct ClearToken)) { return EINVAL; } - bcopy(ain, (char *)&clear, sizeof(struct ClearToken)); + memcpy((char *)&clear, ain, sizeof(struct ClearToken)); if (clear.AuthHandle == -1) clear.AuthHandle = 999; /* more rxvab compat stuff */ ain += sizeof(struct ClearToken); if (ainSize != 2*sizeof(afs_int32) + stLen + sizeof(struct ClearToken)) { /* still stuff left? we've got primary flag and cell name. Set these */ - bcopy(ain, (char *)&flag, sizeof(afs_int32)); /* primary id flag */ + memcpy((char *)&flag, ain, sizeof(afs_int32)); /* primary id flag */ ain += sizeof(afs_int32); /* skip id field */ /* rest is cell name, look it up */ if (flag & 0x8000) { /* XXX Use Constant XXX */ @@ -1452,7 +1452,7 @@ static PGCPAGs(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) } tu->stp = (char *) afs_osi_Alloc(stLen); tu->stLen = stLen; - bcopy(stp, tu->stp, stLen); + memcpy(tu->stp, stp, stLen); tu->ct = clear; #ifndef AFS_NOSTATS afs_stats_cmfullperf.authent.TicketUpdates++; @@ -1523,7 +1523,7 @@ static PGetVolumeStatus(avc, afun, areq, ain, aout, ainSize, aoutSize) if (code) return code; /* Copy all this junk into msg->im_data, keeping track of the lengths. */ cp = aout; - bcopy((char *)&volstat, cp, sizeof(VolumeStatus)); + memcpy(cp, (char *)&volstat, sizeof(VolumeStatus)); cp += sizeof(VolumeStatus); strcpy(cp, volName); cp += strlen(volName)+1; @@ -1567,7 +1567,7 @@ static PSetVolumeStatus(avc, afun, areq, ain, aout, ainSize, aoutSize) return ENODEV; /* Copy the junk out, using cp as a roving pointer. */ cp = ain; - bcopy(cp, (char *)&volstat, sizeof(AFSFetchVolumeStatus)); + memcpy((char *)&volstat, cp, sizeof(AFSFetchVolumeStatus)); cp += sizeof(AFSFetchVolumeStatus); if (strlen(cp) >= sizeof(volName)) return E2BIG; @@ -1613,7 +1613,7 @@ static PSetVolumeStatus(avc, afun, areq, ain, aout, ainSize, aoutSize) /* we are sending parms back to make compat. with prev system. should change interface later to not ask for current status, just set new status */ cp = aout; - bcopy((char *)&volstat, cp, sizeof(VolumeStatus)); + memcpy(cp, (char *)&volstat, sizeof(VolumeStatus)); cp += sizeof(VolumeStatus); strcpy(cp, volName); cp += strlen(volName)+1; @@ -1760,7 +1760,7 @@ static PGetTokens(avc, afun, areq, ain, aout, ainSize, aoutSize) at the end, in that order. */ if (newStyle = (ainSize > 0)) { - bcopy(ain, (char *)&iterator, sizeof(afs_int32)); + memcpy((char *)&iterator, ain, sizeof(afs_int32)); } i = UHash(areq->uid); ObtainReadLock(&afs_xuser); @@ -1794,19 +1794,19 @@ static PGetTokens(avc, afun, areq, ain, aout, ainSize, aoutSize) cp = aout; iterator = tu->stLen; /* for compat, we try to return 56 byte tix if they fit */ if (iterator < 56) iterator = 56; /* # of bytes we're returning */ - bcopy((char *)&iterator, cp, sizeof(afs_int32)); + memcpy(cp, (char *)&iterator, sizeof(afs_int32)); cp += sizeof(afs_int32); - bcopy(tu->stp, cp, tu->stLen); /* copy out st */ + memcpy(cp, tu->stp, tu->stLen); /* copy out st */ cp += iterator; iterator = sizeof(struct ClearToken); - bcopy((char *)&iterator, cp, sizeof(afs_int32)); + memcpy(cp, (char *)&iterator, sizeof(afs_int32)); cp += sizeof(afs_int32); - bcopy((char *)&tu->ct, cp, sizeof(struct ClearToken)); + memcpy(cp, (char *)&tu->ct, sizeof(struct ClearToken)); cp += sizeof(struct ClearToken); if (newStyle) { /* put out primary id and cell name, too */ iterator = (tu->states & UPrimary ? 1 : 0); - bcopy((char *)&iterator, cp, sizeof(afs_int32)); + memcpy(cp, (char *)&iterator, sizeof(afs_int32)); cp += sizeof(afs_int32); tcell = afs_GetCell(tu->cell, READ_LOCK); if (tcell) { @@ -1842,7 +1842,7 @@ static PUnlog(avc, afun, areq, ain, aout, ainSize, aoutSize) tu->vid = UNDEFVID; tu->states &= ~UHasTokens; /* security is not having to say you're sorry */ - bzero((char *)&tu->ct, sizeof(struct ClearToken)); + memset((char *)&tu->ct, 0, sizeof(struct ClearToken)); tu->refCount++; ReleaseWriteLock(&afs_xuser); /* We have to drop the lock over the call to afs_ResetUserConns, since @@ -1881,11 +1881,11 @@ static PMariner(avc, afun, areq, ain, aout, ainSize, aoutSize) AFS_STATCNT(PMariner); if (afs_mariner) - bcopy((char *)&afs_marinerHost, (char *)&oldHostAddr, sizeof(afs_int32)); + memcpy((char *)&oldHostAddr, (char *)&afs_marinerHost, sizeof(afs_int32)); else oldHostAddr = 0xffffffff; /* disabled */ - bcopy(ain, (char *)&newHostAddr, sizeof(afs_int32)); + memcpy((char *)&newHostAddr, ain, sizeof(afs_int32)); if (newHostAddr == 0xffffffff) { /* disable mariner operations */ afs_mariner = 0; @@ -1894,7 +1894,7 @@ static PMariner(avc, afun, areq, ain, aout, ainSize, aoutSize) afs_mariner = 1; afs_marinerHost = newHostAddr; } - bcopy((char *)&oldHostAddr, aout, sizeof(afs_int32)); + memcpy(aout, (char *)&oldHostAddr, sizeof(afs_int32)); *aoutSize = sizeof(afs_int32); return 0; } @@ -1924,7 +1924,7 @@ static PCheckServers(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) pcheck=(struct chservinfo *)ain; if (pcheck->tinterval >= 0) { cp = aout; - bcopy((char *)&PROBE_INTERVAL, cp, sizeof(afs_int32)); + memcpy(cp, (char *)&PROBE_INTERVAL, sizeof(afs_int32)); *aoutSize = sizeof(afs_int32); if (pcheck->tinterval > 0) { if (!afs_osi_suser(acred)) @@ -1938,7 +1938,7 @@ static PCheckServers(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) temp=pcheck->tflags; cp = pcheck->tbuffer; } else { /* For pre afs3.3 versions */ - bcopy(ain, (char *)&temp, sizeof(afs_int32)); + memcpy((char *)&temp, ain, sizeof(afs_int32)); cp = ain+sizeof(afs_int32); if (ainSize > sizeof(afs_int32)) havecell = 1; @@ -1969,7 +1969,7 @@ static PCheckServers(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) for(ts = afs_servers[i]; ts; ts=ts->next) { if (cellp && ts->cell != cellp) continue; /* cell spec'd and wrong */ if ((ts->flags & SRVR_ISDOWN) && ts->addr->sa_portal != ts->cell->vlport) { - bcopy((char *)&ts->addr->sa_ip, cp, sizeof(afs_int32)); + memcpy(cp, (char *)&ts->addr->sa_ip, sizeof(afs_int32)); cp += sizeof(afs_int32); } } @@ -2040,7 +2040,7 @@ static PCheckAuth(avc, afun, areq, ain, aout, ainSize, aoutSize) ReleaseReadLock(&afs_xconn); afs_PutUser(tu, READ_LOCK); } - bcopy((char *)&retValue, aout, sizeof(afs_int32)); + memcpy(aout, (char *)&retValue, sizeof(afs_int32)); *aoutSize = sizeof(afs_int32); return 0; } @@ -2095,13 +2095,13 @@ static PFindVolume(avc, afun, areq, ain, aout, ainSize, aoutSize) for(i=0;iserverHost[i]; if (!ts) break; - bcopy((char *)&ts->addr->sa_ip, cp, sizeof(afs_int32)); + memcpy(cp, (char *)&ts->addr->sa_ip, sizeof(afs_int32)); cp += sizeof(afs_int32); } if (icellHosts[i] == 0) break; - bcopy((char *)&tcell->cellHosts[i]->addr->sa_ip, cp, sizeof(afs_int32)); + memcpy(cp, (char *)&tcell->cellHosts[i]->addr->sa_ip, sizeof(afs_int32)); cp += sizeof(afs_int32); } cp = aout + MAXCELLHOSTS * sizeof(afs_int32); @@ -2495,7 +2495,7 @@ static PGetCellStatus(avc, afun, areq, ain, aout, ainSize, aoutSize) if (!tcell) return ENOENT; temp = tcell->states; afs_PutCell(tcell, READ_LOCK); - bcopy((char *)&temp, aout, sizeof(afs_int32)); + memcpy(aout, (char *)&temp, sizeof(afs_int32)); *aoutSize = sizeof(afs_int32); return 0; } @@ -2518,7 +2518,7 @@ static PSetCellStatus(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) tcell = afs_GetCellByName(ain+2*sizeof(afs_int32), WRITE_LOCK); if (!tcell) return ENOENT; - bcopy(ain, (char *)&temp, sizeof(afs_int32)); + memcpy((char *)&temp, ain, sizeof(afs_int32)); if (temp & CNoSUID) tcell->states |= CNoSUID; else @@ -2681,7 +2681,7 @@ static PGetVnodeXStatus(avc, afun, areq, ain, aout, ainSize, aoutSize) stat.flockCount = avc->flockCount; stat.mvstat = avc->mvstat; stat.states = avc->states; - bcopy((char *)&stat, aout, sizeof(struct vcxstat)); + memcpy(aout, (char *)&stat, sizeof(struct vcxstat)); *aoutSize = sizeof(struct vcxstat); return 0; } @@ -2721,8 +2721,8 @@ register struct AFS_UCRED *acred; return (setuerror(EINVAL), EINVAL); #endif } - bzero(inname, MAXSYSNAME); - bcopy(ain, (char *)&setsysname, sizeof(afs_int32)); + memset(inname, 0, MAXSYSNAME); + memcpy((char *)&setsysname, ain, sizeof(afs_int32)); ain += sizeof(afs_int32); if (setsysname) { @@ -2743,7 +2743,7 @@ register struct AFS_UCRED *acred; /* inname gets first entry in case we're being a translater */ t = strlen(ain); - bcopy(ain, inname, t+1); /* include terminating null */ + memcpy(inname, ain, t+1); /* include terminating null */ ain += t + 1; } if (acred->cr_gid == RMTUSER_REQ) { /* Handles all exporters */ @@ -2789,7 +2789,7 @@ register struct AFS_UCRED *acred; if (!afs_sysnamelist[count]) osi_Panic("PSetSysName: no afs_sysnamelist entry to write\n"); t = strlen(cp); - bcopy(cp, afs_sysnamelist[count], t+1); /* include null */ + memcpy(afs_sysnamelist[count], cp, t+1); /* include null */ cp += t+1; } } @@ -2798,7 +2798,7 @@ register struct AFS_UCRED *acred; } if (!setsysname) { cp = aout; /* not changing so report back the count and ... */ - bcopy((char *)&foundname, cp, sizeof(afs_int32)); + memcpy(cp, (char *)&foundname, sizeof(afs_int32)); cp += sizeof(afs_int32); if (foundname) { strcpy(cp, outname); /* ... the entry, ... */ @@ -3094,7 +3094,7 @@ struct AFS_UCRED *acred; register struct afs_exporter *exporter; AFS_STATCNT(PExportAfs); - bcopy(ain, (char *)&handleValue, sizeof(afs_int32)); + memcpy((char *)&handleValue, ain, sizeof(afs_int32)); type = handleValue >> 24; if (type == 0x71) { newint = 1; @@ -3120,7 +3120,7 @@ struct AFS_UCRED *acred; } if (!changestate) { handleValue = exporter->exp_states; - bcopy((char *)&handleValue, aout, sizeof(afs_int32)); + memcpy(aout, (char *)&handleValue, sizeof(afs_int32)); *aoutSize = sizeof(afs_int32); } else { if (!afs_osi_suser(acred)) @@ -3154,7 +3154,7 @@ struct AFS_UCRED *acred; } } handleValue = exporter->exp_states; - bcopy((char *)&handleValue, aout, sizeof(afs_int32)); + memcpy(aout, (char *)&handleValue, sizeof(afs_int32)); *aoutSize = sizeof(afs_int32); } else { if (export) @@ -3258,7 +3258,7 @@ static int PGetInitParams(avc, afun, areq, ain, aout, ainSize, aoutSize) if (sizeof(struct cm_initparams) > PIGGYSIZE) return E2BIG; - bcopy((char*)&cm_initParams, aout, sizeof(struct cm_initparams)); + memcpy(aout, (char*)&cm_initParams, sizeof(struct cm_initparams)); *aoutSize = sizeof(struct cm_initparams); return 0; } @@ -3269,7 +3269,7 @@ static cred_t *crget(void) { cred_t *cr; cr = crdup(get_current_cred()); - bzero((char*)cr, sizeof(cred_t)); + memset((char*)cr, 0, sizeof(cred_t)); #if CELL || CELL_PREPARE cr->cr_id = -1; #endif @@ -3287,7 +3287,7 @@ afs_int32 ainSize; afs_int32 *aoutSize; struct AFS_UCRED *acred; { - bcopy((char *)&cryptall, aout, sizeof(afs_int32)); + memcpy(aout, (char *)&cryptall, sizeof(afs_int32)); *aoutSize=sizeof(afs_int32); return 0; } @@ -3308,7 +3308,7 @@ struct AFS_UCRED *acred; return EPERM; if (ainSize != sizeof(afs_int32) || ain == NULL) return EINVAL; - bcopy(ain, (char *)&tmpval, sizeof(afs_int32)); + memcpy((char *)&tmpval, ain, sizeof(afs_int32)); /* if new mappings added later this will need to be changed */ if (tmpval != 0 && tmpval != 1) return EINVAL; @@ -3642,7 +3642,7 @@ static PRxStatProc(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) code = EINVAL; goto out; } - bcopy(ain, (char *)&flags, sizeof(afs_int32)); + memcpy((char *)&flags, ain, sizeof(afs_int32)); if (!(flags & AFSCALL_RXSTATS_MASK) || (flags & ~AFSCALL_RXSTATS_MASK)) { code = EINVAL; goto out; @@ -3682,7 +3682,7 @@ static PRxStatPeer(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) code = EINVAL; goto out; } - bcopy(ain, (char *)&flags, sizeof(afs_int32)); + memcpy((char *)&flags, ain, sizeof(afs_int32)); if (!(flags & AFSCALL_RXSTATS_MASK) || (flags & ~AFSCALL_RXSTATS_MASK)) { code = EINVAL; goto out; diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index 05584e8..980e5ea 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -237,7 +237,7 @@ afs_StoreAllSegments(avc, areq, sync) minj = 0 ; do { - bzero ((char *)dcList, NCHUNKSATONCE * sizeof(struct dcache *)); + memset((char *)dcList, 0, NCHUNKSATONCE * sizeof(struct dcache *)); high = 0; moredata = FALSE; @@ -448,7 +448,7 @@ afs_StoreAllSegments(avc, areq, sync) while (sbytes > 0) { tlen = (sbytes > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : sbytes); - bzero(tbuffer, tlen); + memset(tbuffer, 0, tlen); #ifdef RX_ENABLE_LOCKS AFS_GUNLOCK(); #endif /* RX_ENABLE_LOCKS */ diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index b56e19c..7ce9d88 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -380,26 +380,22 @@ void afs_CountServers() afs_stats_cmperf.fs_UpDown[0].sumOfRecordAges = 0; afs_stats_cmperf.fs_UpDown[0].ageOfYoungestRecord = 0; afs_stats_cmperf.fs_UpDown[0].ageOfOldestRecord = 0; - bzero((char *) afs_stats_cmperf.fs_UpDown[0].downIncidents, - AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); + memset((char *) afs_stats_cmperf.fs_UpDown[0].downIncidents, 0, AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); afs_stats_cmperf.fs_UpDown[1].sumOfRecordAges = 0; afs_stats_cmperf.fs_UpDown[1].ageOfYoungestRecord = 0; afs_stats_cmperf.fs_UpDown[1].ageOfOldestRecord = 0; - bzero((char *) afs_stats_cmperf.fs_UpDown[1].downIncidents, - AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); + memset((char *) afs_stats_cmperf.fs_UpDown[1].downIncidents, 0, AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); afs_stats_cmperf.vl_UpDown[0].sumOfRecordAges = 0; afs_stats_cmperf.vl_UpDown[0].ageOfYoungestRecord = 0; afs_stats_cmperf.vl_UpDown[0].ageOfOldestRecord = 0; - bzero((char *) afs_stats_cmperf.vl_UpDown[0].downIncidents, - AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); + memset((char *) afs_stats_cmperf.vl_UpDown[0].downIncidents, 0, AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); afs_stats_cmperf.vl_UpDown[1].sumOfRecordAges = 0; afs_stats_cmperf.vl_UpDown[1].ageOfYoungestRecord = 0; afs_stats_cmperf.vl_UpDown[1].ageOfOldestRecord = 0; - bzero((char *) afs_stats_cmperf.vl_UpDown[1].downIncidents, - AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); + memset((char *) afs_stats_cmperf.vl_UpDown[1].downIncidents, 0, AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); /* * Compute the current time, used to figure out server record ages. @@ -661,7 +657,7 @@ struct server *afs_FindServer (afs_int32 aserver, ushort aport, i = afs_uuid_hash(uuidp) % NSERVERS; for (ts = afs_servers[i]; ts; ts = ts->next) { if ( (ts->flags & SRVR_MULTIHOMED) && - (bcmp((char *)uuidp, (char *)&ts->sr_uuid, sizeof(*uuidp)) == 0) && + (memcmp((char *)uuidp, (char *)&ts->sr_uuid, sizeof(*uuidp)) == 0) && (!ts->addr || (ts->addr->sa_portal == aport)) ) return ts; } @@ -1382,7 +1378,7 @@ struct server *afs_GetServer(afs_uint32 *aserverp, afs_int32 nservers, newts = (struct server *) afs_osi_Alloc(sizeof(struct server)); if (!newts) panic("malloc of server struct"); afs_totalServers++; - bzero((char *)newts, sizeof(struct server)); + memset((char *)newts, 0, sizeof(struct server)); /* Add the server struct to the afs_servers[] hash chain */ srvhash = (uuidp ? (afs_uuid_hash(uuidp)%NSERVERS) : SHash(aserverp[0])); @@ -1423,7 +1419,7 @@ struct server *afs_GetServer(afs_uint32 *aserverp, afs_int32 nservers, newsa = (struct srvAddr *) afs_osi_Alloc(sizeof(struct srvAddr)); if (!newsa) panic("malloc of srvAddr struct"); afs_totalSrvAddrs++; - bzero((char *)newsa, sizeof(struct srvAddr)); + memset((char *)newsa, 0, sizeof(struct srvAddr)); /* Add the new srvAddr to the afs_srvAddrs[] hash chain */ newsa->next_bkt = afs_srvAddrs[iphash]; @@ -1471,7 +1467,7 @@ struct server *afs_GetServer(afs_uint32 *aserverp, afs_int32 nservers, if (!orphts) { orphts = (struct server *) afs_osi_Alloc(sizeof(struct server)); if (!orphts) panic("malloc of lo server struct"); - bzero((char *)orphts, sizeof(struct server)); + memset((char *)orphts, 0, sizeof(struct server)); afs_totalServers++; /* Add the orphaned server to the afs_servers[] hash chain. diff --git a/src/afs/afs_stat.c b/src/afs/afs_stat.c index 850b3b9..01e1986 100644 --- a/src/afs/afs_stat.c +++ b/src/afs/afs_stat.c @@ -48,10 +48,9 @@ void afs_InitStats() /* * First step is to zero everything out. */ - bzero((char *)(&afs_cmstats), sizeof(struct afs_CMStats)); - bzero((char *)(&afs_stats_cmperf), sizeof(struct afs_stats_CMPerf)); - bzero((char *)(&afs_stats_cmfullperf), - sizeof(struct afs_stats_CMFullPerf)); + memset((char *)(&afs_cmstats), 0, sizeof(struct afs_CMStats)); + memset((char *)(&afs_stats_cmperf), 0, sizeof(struct afs_stats_CMPerf)); + memset((char *)(&afs_stats_cmfullperf), 0, sizeof(struct afs_stats_CMFullPerf)); /* * Some fields really should be non-zero at the start, so set 'em up. diff --git a/src/afs/afs_user.c b/src/afs/afs_user.c index e40abd5..3935063 100644 --- a/src/afs/afs_user.c +++ b/src/afs/afs_user.c @@ -479,7 +479,7 @@ struct unixuser *afs_GetUser(auid, acell, locktype) #ifndef AFS_NOSTATS afs_stats_cmfullperf.authent.PAGCreations++; #endif /* AFS_NOSTATS */ - bzero((char *)tu, sizeof(struct unixuser)); + memset((char *)tu, 0, sizeof(struct unixuser)); tu->next = afs_users[i]; afs_users[i] = tu; if (RmtUser) { diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 136e14f..923dc6e 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -752,7 +752,7 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, #endif /* AFS_MACH_ENV */ #if defined(AFS_SGI_ENV) { char name[METER_NAMSZ]; - bzero(tvc, sizeof(struct vcache)); + memset(tvc, 0, sizeof(struct vcache)); tvc->v.v_number = ++afsvnumbers; tvc->vc_rwlockid = OSI_NO_LOCKID; initnsema(&tvc->vc_rwlock, 1, makesname(name, "vrw", tvc->v.v_number)); @@ -777,7 +777,7 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, #endif /* AFS_MACH_ENV */ #if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) - bzero((char *)tvc, sizeof(struct vcache)); + memset((char *)tvc, 0, sizeof(struct vcache)); #else tvc->uncred = 0; #endif @@ -851,10 +851,10 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, #ifdef AFS_AIX_ENV /* Don't forget to free the gnode space */ tvc->v.v_gnode = gnodepnt = (struct gnode *) osi_AllocSmallSpace(sizeof(struct gnode)); - bzero((char *)gnodepnt, sizeof(struct gnode)); + memset((char *)gnodepnt, 0, sizeof(struct gnode)); #endif #ifdef AFS_SGI64_ENV - bzero((void*)&(tvc->vc_bhv_desc), sizeof(tvc->vc_bhv_desc)); + memset((void*)&(tvc->vc_bhv_desc), 0, sizeof(tvc->vc_bhv_desc)); bhv_desc_init(&(tvc->vc_bhv_desc), tvc, tvc, &Afs_vnodeops); #ifdef AFS_SGI65_ENV vn_bhv_head_init(&(tvc->v.v_bh), "afsvp"); @@ -974,8 +974,8 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, #endif tvc->h1.dchint = 0; osi_dnlc_purgedp(tvc); /* this may be overkill */ - bzero((char *)&(tvc->quick),sizeof(struct vtodc)); - bzero((char *)&(tvc->callsort),sizeof(struct afs_q)); + memset((char *)&(tvc->quick), 0, sizeof(struct vtodc)); + memset((char *)&(tvc->callsort), 0, sizeof(struct afs_q)); tvc->slocks = (struct SimpleLocks *)0; i = VCHash(afid); @@ -2602,7 +2602,7 @@ void afs_vcacheInit(int astatSize) #if !defined(AFS_OSF_ENV) /* Allocate and thread the struct vcache entries */ tvp = (struct vcache *) afs_osi_Alloc(astatSize * sizeof(struct vcache)); - bzero((char *)tvp, sizeof(struct vcache)*astatSize); + memset((char *)tvp, 0, sizeof(struct vcache)*astatSize); Initial_freeVCList = tvp; freeVCList = &(tvp[0]); diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index b7575fd..6ca9dc6 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -464,7 +464,7 @@ static struct volume *afs_SetupVolume(volid, aname, ve, tcell, agood, type, areq struct fvolume *tf=0; tv = afs_GetVolSlot(); - bzero((char *)tv, sizeof(struct volume)); + memset((char *)tv, 0, sizeof(struct volume)); tv->cell = tcell->cell; RWLOCK_INIT(&tv->lock, "volume lock"); tv->next = afs_volumes[i]; /* thread into list */ @@ -912,11 +912,11 @@ void InstallUVolumeEntry(struct volume *av, struct uvldbentry *ve, ListAddrByAttributes attrs; afsUUID uuid; - bzero((char *)&attrs, sizeof(attrs)); + memset((char *)&attrs, 0, sizeof(attrs)); attrs.Mask = VLADDR_UUID; attrs.uuid = ve->serverNumber[i]; - bzero((char *)&uuid, sizeof(uuid)); - bzero((char *)&addrs, sizeof(addrs)); + memset((char *)&uuid, 0, sizeof(uuid)); + memset((char *)&addrs, 0, sizeof(addrs)); do { tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport, tcell->cell, areq, SHARED_LOCK); diff --git a/src/afsmonitor/afsmonitor.c b/src/afsmonitor/afsmonitor.c index 73f7b72..0c608ae 100644 --- a/src/afsmonitor/afsmonitor.c +++ b/src/afsmonitor/afsmonitor.c @@ -319,7 +319,7 @@ char *name; #ifdef AFS_SUN5_ENV /* On solaris the above does not resolve hostnames to full names */ if (he != (struct hostent *)0) { - bcopy(he->h_addr, ip_addr, he->h_length); + memcpy(ip_addr, he->h_addr, he->h_length); he = gethostbyaddr(ip_addr, he->h_length, he->h_addrtype); } #endif @@ -1507,7 +1507,7 @@ char *a_config_filename; fprintf(stderr,"[ %s ] Memory Allocation error 1",rn); afsmon_Exit(25); } - bzero(curr_host->thresh,numBytes); + memset(curr_host->thresh, 0, numBytes); } curr_host = curr_host->next;; } @@ -1525,7 +1525,7 @@ char *a_config_filename; fprintf(stderr,"[ %s ] Memory Allocation error 2",rn); afsmon_Exit(35); } - bzero(curr_host->thresh,numBytes); + memset(curr_host->thresh, 0, numBytes); } curr_host = curr_host->next;; } @@ -1710,8 +1710,7 @@ int a_newProbeCycle; /* start of a new probe cycle ? */ /* copy hostname and probe number and probe time and probe status. if the probe failed return now */ - bcopy(xstat_fs_Results.connP->hostName, tmp_fsPR->connP->hostName, - sizeof(xstat_fs_Results.connP->hostName)); + memcpy(tmp_fsPR->connP->hostName, xstat_fs_Results.connP->hostName, sizeof(xstat_fs_Results.connP->hostName)); tmp_fsPR->probeNum = xstat_fs_Results.probeNum; tmp_fsPR->probeTime = xstat_fs_Results.probeTime; tmp_fsPR->probeOK = xstat_fs_Results.probeOK; @@ -1722,23 +1721,14 @@ int a_newProbeCycle; /* start of a new probe cycle ? */ } /* copy connection information */ -#if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) - bcopy(&(xstat_fs_Results.connP->skt), &(tmp_fsPR->connP->skt), - sizeof(struct sockaddr_in)); -#else - bcopy(xstat_fs_Results.connP->skt, tmp_fsPR->connP->skt, - sizeof(struct sockaddr_in)); -#endif + memcpy(&(tmp_fsPR->connP->skt), &(xstat_fs_Results.connP->skt), sizeof(struct sockaddr_in)); - bcopy(xstat_fs_Results.connP->hostName, tmp_fsPR->connP->hostName, - sizeof(xstat_fs_Results.connP->hostName)); + memcpy(tmp_fsPR->connP->hostName, xstat_fs_Results.connP->hostName, sizeof(xstat_fs_Results.connP->hostName)); tmp_fsPR->collectionNumber = xstat_fs_Results.collectionNumber; /* copy the probe data information */ tmp_fsPR->data.AFS_CollData_len = xstat_fs_Results.data.AFS_CollData_len; - bcopy(xstat_fs_Results.data.AFS_CollData_val, - tmp_fsPR->data.AFS_CollData_val, - xstat_fs_Results.data.AFS_CollData_len * sizeof(afs_int32)); + memcpy(tmp_fsPR->data.AFS_CollData_val, xstat_fs_Results.data.AFS_CollData_val, xstat_fs_Results.data.AFS_CollData_len * sizeof(afs_int32)); /* we have a valid results structure so mark the list item used */ @@ -2198,8 +2188,7 @@ struct xstat_fs_ProbeResults *a_fsResults; /* backup the display data of the probe cycle that just completed - ie., store curr_fsData in prev_fsData */ - bcopy((char *)curr_fsData, (char *)prev_fsData, - (numFS * sizeof(struct fs_Display_Data)) ); + memcpy((char *)prev_fsData, (char *)curr_fsData, (numFS * sizeof(struct fs_Display_Data)) ); /* initialize curr_fsData but retain the threshold flag information. @@ -2210,7 +2199,7 @@ struct xstat_fs_ProbeResults *a_fsResults; for(i=0; iprobeOK = 0; curr_fsDataP->ovfCount = 0; - bzero((char *)curr_fsDataP->data, numBytes); + memset((char *)curr_fsDataP->data, 0, numBytes); curr_fsDataP++; } @@ -2439,8 +2428,7 @@ int a_newProbeCycle; /* start of new probe cycle ? */ /* copy hostname and probe number and probe time and probe status. if the probe failed return now */ - bcopy(xstat_cm_Results.connP->hostName, tmp_cmPR->connP->hostName, - sizeof(xstat_cm_Results.connP->hostName)); + memcpy(tmp_cmPR->connP->hostName, xstat_cm_Results.connP->hostName, sizeof(xstat_cm_Results.connP->hostName)); tmp_cmPR->probeNum = xstat_cm_Results.probeNum; tmp_cmPR->probeTime = xstat_cm_Results.probeTime; tmp_cmPR->probeOK = xstat_cm_Results.probeOK; @@ -2452,25 +2440,16 @@ int a_newProbeCycle; /* start of new probe cycle ? */ /* copy connection information */ -#if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) - bcopy(&(xstat_cm_Results.connP->skt), &(tmp_cmPR->connP->skt), - sizeof(struct sockaddr_in)); -#else - bcopy(xstat_cm_Results.connP->skt, tmp_cmPR->connP->skt, - sizeof(struct sockaddr_in)); -#endif + memcpy(&(tmp_cmPR->connP->skt), &(xstat_cm_Results.connP->skt), sizeof(struct sockaddr_in)); /**** NEED TO COPY rx_connection INFORMATION HERE ******/ - bcopy(xstat_cm_Results.connP->hostName, tmp_cmPR->connP->hostName, - sizeof(xstat_cm_Results.connP->hostName)); + memcpy(tmp_cmPR->connP->hostName, xstat_cm_Results.connP->hostName, sizeof(xstat_cm_Results.connP->hostName)); tmp_cmPR->collectionNumber = xstat_cm_Results.collectionNumber; /* copy the probe data information */ tmp_cmPR->data.AFSCB_CollData_len = xstat_cm_Results.data.AFSCB_CollData_len; - bcopy(xstat_cm_Results.data.AFSCB_CollData_val, - tmp_cmPR->data.AFSCB_CollData_val, - xstat_cm_Results.data.AFSCB_CollData_len * sizeof(afs_int32)); + memcpy(tmp_cmPR->data.AFSCB_CollData_val, xstat_cm_Results.data.AFSCB_CollData_val, xstat_cm_Results.data.AFSCB_CollData_len * sizeof(afs_int32)); /* we have a valid results structure so mark the list item used */ @@ -2953,8 +2932,7 @@ struct xstat_cm_ProbeResults *a_cmResults; /* backup the display data of the probe cycle that just completed - ie., store curr_cmData in prev_cmData */ - bcopy((char *)curr_cmData, (char *)prev_cmData, - (numCM * sizeof(struct cm_Display_Data)) ); + memcpy((char *)prev_cmData, (char *)curr_cmData, (numCM * sizeof(struct cm_Display_Data)) ); /* initialize curr_cmData but retain the threshold flag information. @@ -2965,7 +2943,7 @@ struct xstat_cm_ProbeResults *a_cmResults; for(i=0; iprobeOK = 0; curr_cmDataP->ovfCount = 0; - bzero((char *)curr_cmDataP->data, numBytes); + memset((char *)curr_cmDataP->data, 0, numBytes); curr_cmDataP++; } @@ -3359,7 +3337,7 @@ init_print_buffers() fprintf(stderr,"[ %s ] Memory allocation failure\n",rn); return(-1); } - bzero(curr_fsData,numBytes); + memset(curr_fsData, 0, numBytes); numBytes = numFS * sizeof(struct fs_Display_Data); prev_fsData = (struct fs_Display_Data *) malloc(numBytes); @@ -3367,7 +3345,7 @@ init_print_buffers() fprintf(stderr,"[ %s ] Memory allocation failure\n",rn); return(-5); } - bzero(prev_fsData,numBytes); + memset(prev_fsData, 0, numBytes); /* fill in the host names */ tmp_fsData1 = curr_fsData; @@ -3394,7 +3372,7 @@ init_print_buffers() fprintf(stderr,"[ %s ] Memory allocation failure\n",rn); return(-10); } - bzero(curr_cmData,numBytes); + memset(curr_cmData, 0, numBytes); numBytes = numCM * sizeof(struct cm_Display_Data); prev_cmData = (struct cm_Display_Data *) malloc(numBytes); @@ -3402,7 +3380,7 @@ init_print_buffers() fprintf(stderr,"[ %s ] Memory allocation failure\n",rn); return(-15); } - bzero(prev_cmData,numBytes); + memset(prev_cmData, 0, numBytes); /* fill in the host names */ tmp_cmData1 = curr_cmData; @@ -3496,7 +3474,7 @@ afsmon_execute() return(-1); } - bzero(FSSktArray, FSsktbytes); + memset(FSSktArray, 0, FSsktbytes); /* Fill in the socket information for each fileserve */ @@ -3510,7 +3488,7 @@ afsmon_execute() return(-1); } strncpy(curr_FS->hostName,he->h_name,HOST_NAME_LEN); /* complete name*/ - bcopy(he->h_addr, &(curr_skt->sin_addr.s_addr), 4); + memcpy(&(curr_skt->sin_addr.s_addr), he->h_addr, 4); curr_skt->sin_family = htons(AF_INET); /*Internet family*/ curr_skt->sin_port = htons(7000); /*FileServer port*/ @@ -3567,7 +3545,7 @@ afsmon_execute() return(-1); } - bzero(CMSktArray, CMsktbytes); + memset(CMSktArray, 0, CMsktbytes); /* Fill in the socket information for each CM */ @@ -3581,7 +3559,7 @@ afsmon_execute() return(-1); } strncpy(curr_CM->hostName,he->h_name,HOST_NAME_LEN); /* complete name*/ - bcopy(he->h_addr, &(curr_skt->sin_addr.s_addr), 4); + memcpy(&(curr_skt->sin_addr.s_addr), he->h_addr, 4); curr_skt->sin_family = htons(AF_INET); /*Internet family*/ curr_skt->sin_port = htons(7001); /*Cache Manager port*/ diff --git a/src/afsweb/apache_afs_cache.c b/src/afsweb/apache_afs_cache.c index 354bdf9..70fc42f 100644 --- a/src/afsweb/apache_afs_cache.c +++ b/src/afsweb/apache_afs_cache.c @@ -473,10 +473,10 @@ int getTokenLen(char *buf) afs_int32 EndTimestamp; } token; tp=buf; - bcopy(tp, &len, sizeof(afs_int32)); /* get size of secret token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of secret token */ rc=(len+sizeof(afs_int32)); tp += (sizeof(afs_int32) + len); /* skip secret token and its length */ - bcopy(tp, &len, sizeof(afs_int32)); /* get size of clear token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of clear token */ if (len != sizeof(struct ClearToken)) { #ifdef DEBUG fprintf(stderr, "apache_afs_cache.c:getExpiration:" @@ -508,9 +508,9 @@ long getExpiration(char *buf) } token; tp = buf; - bcopy(tp, &len, sizeof(afs_int32)); /* get size of secret token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of secret token */ tp += (sizeof(afs_int32) + len); /* skip secret token and its length */ - bcopy(tp, &len, sizeof(afs_int32)); /* get size of clear token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of clear token */ if (len != sizeof(struct ClearToken)) { #ifdef DEBUG fprintf(stderr, "apache_afs_cache.c:getExpiration:" @@ -520,6 +520,6 @@ long getExpiration(char *buf) } tp += sizeof(afs_int32); /* skip length of clear token */ - bcopy(tp, &token, sizeof(struct ClearToken)); /* copy the token */ + memcpy(&token, tp, sizeof(struct ClearToken)); /* copy the token */ return token.EndTimestamp; } diff --git a/src/afsweb/apache_afs_client.c b/src/afsweb/apache_afs_client.c index 7233e58..eda7e7c 100644 --- a/src/afsweb/apache_afs_client.c +++ b/src/afsweb/apache_afs_client.c @@ -376,17 +376,17 @@ static int setToken(char *tokenBuf, int tokenLen) #ifdef OLDSETPAG /* skip over the secret token */ temp = tokenBuf; - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); temp += (i + sizeof(afs_int32)); /* skip over the clear token */ - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); temp += (i + sizeof(afs_int32)); doneSETPAG = 1; - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); i |= 0x8000; - bcopy(&i, temp, sizeof(afs_int32)); + memcpy(temp, &i, sizeof(afs_int32)); temp += sizeof(afs_int32); #endif @@ -455,9 +455,9 @@ int authenticateUser(request_rec *r, char *defaultCell, strcpy(global_default_cell, defaultCell); } - bzero(user,APACHEAFS_USERNAME_MAX); - bzero(passwd,APACHEAFS_PASSWORD_MAX); - bzero(cell,APACHEAFS_CELLNAME_MAX); + memset(user, 0, APACHEAFS_USERNAME_MAX); + memset(passwd, 0, APACHEAFS_PASSWORD_MAX); + memset(cell, 0, APACHEAFS_CELLNAME_MAX); if (auth_line == NULL) { /* No Authorization field - we don't do anything */ /* @@ -468,9 +468,9 @@ int authenticateUser(request_rec *r, char *defaultCell, afslog(15, ("%s: No authline recieved", module_name)); haveAuth = 0; userChanged=1; - bzero(lastUser, APACHEAFS_USERNAME_MAX); - bzero(lastCell, APACHEAFS_CELLNAME_MAX); - bzero(lastCksum, SHA_HASH_BYTES); + memset(lastUser, 0, APACHEAFS_USERNAME_MAX); + memset(lastCell, 0, APACHEAFS_CELLNAME_MAX); + memset(lastCksum, 0, SHA_HASH_BYTES); rc = unlog(); afslog(25, ("%s: pid:%d No Authorization field. Unlogging ...", module_name, getpid())); @@ -503,9 +503,9 @@ int authenticateUser(request_rec *r, char *defaultCell, module_name, getpid())); haveAuth = 0; userChanged = 1; - bzero(lastUser, APACHEAFS_USERNAME_MAX); - bzero(lastCell, APACHEAFS_CELLNAME_MAX); - bzero(lastCksum, SHA_HASH_BYTES); + memset(lastUser, 0, APACHEAFS_USERNAME_MAX); + memset(lastCell, 0, APACHEAFS_CELLNAME_MAX); + memset(lastCksum, 0, SHA_HASH_BYTES); rc = unlog(); if (rc) { sprintf(err_msg, "%s: Error unlogging from AFS cell - rc: %d, errno:%d", @@ -773,7 +773,7 @@ static int geturi(request_rec *r, char *buf) afsassert(r); afsassert(buf); - bzero(buf, APACHEAFS_CELLNAME_MAX); + memset(buf, 0, APACHEAFS_CELLNAME_MAX); pos = strchr(r->uri,'/'); if (pos != NULL) { pos++; @@ -820,7 +820,7 @@ static int parseAuthName_int(request_rec *r, char *buf, char *msg) afsassert(buf); afsassert(msg); - bzero(blank, sizeof(blank)); + memset(blank, 0, sizeof(blank)); afslog(50, ("%s: Parsing Authorization Required reply. buf:%s", module_name, buf)); pos = strchr(buf, '<'); @@ -873,7 +873,7 @@ static int parseAuthName_int(request_rec *r, char *buf, char *msg) pos++; strcat(msg, pos); strcpy(buf, msg); - bzero(msg, 1024); + memset(msg, 0, 1024); parseAuthName_int(r, buf, msg); return 0; } @@ -899,7 +899,7 @@ static int parseAuthName(request_rec *r, char *buf) afsassert(r); afsassert(buf); - bzero(msg, sizeof(msg)); + memset(msg, 0, sizeof(msg)); pos=strchr(buf,'<'); while (pos != NULL) { @@ -910,7 +910,7 @@ static int parseAuthName(request_rec *r, char *buf) return -1; } strcpy(buf, msg); - bzero(msg, sizeof(msg)); + memset(msg, 0, sizeof(msg)); pos = strchr(buf, '<'); } afslog(50, ("%s: Parsing WWW Auth required reply. final message:%s", diff --git a/src/afsweb/apache_afs_utils.c b/src/afsweb/apache_afs_utils.c index 2309120..aa12df4 100644 --- a/src/afsweb/apache_afs_utils.c +++ b/src/afsweb/apache_afs_utils.c @@ -74,17 +74,17 @@ flipPrimary(char *tokenBuf) char * temp = tokenBuf; /* skip over the secret token */ - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); temp += (i + sizeof(afs_int32)); /* skip over the clear token */ - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); temp += (i + sizeof(afs_int32)); /* set the primary flag */ - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); i |= 0x8000; - bcopy(&i, temp, sizeof(afs_int32)); + memcpy(temp, &i, sizeof(afs_int32)); temp += sizeof(afs_int32); return 0; } @@ -222,21 +222,21 @@ void parseToken(char *buf) assert ( buf != NULL ); tp = buf; - bcopy(tp, &len, sizeof(afs_int32)); /* get size of secret token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of secret token */ tp += (sizeof(afs_int32)+ len); /* skip secret token */ - bcopy(tp, &len, sizeof(afs_int32)); /* get size of clear token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of clear token */ if (len != sizeof(struct ClearToken)) { fprintf(stderr, "weblog:parseToken: error getting length of ClearToken\n"); return; } tp += sizeof(afs_int32); /* skip length of cleartoken */ - bcopy(tp, &clearToken, sizeof(struct ClearToken)); /* copy cleartoken */ + memcpy(&clearToken, tp, sizeof(struct ClearToken)); /* copy cleartoken */ tp += len; /* skip clear token itself */ - bcopy(tp, &len, sizeof(afs_int32)); /* copy the primary flag */ + memcpy(&len, tp, sizeof(afs_int32)); /* copy the primary flag */ tp += sizeof(afs_int32); /* skip primary flag */ /* tp now points to the cell name */ diff --git a/src/afsweb/apache_includes/1.2/conf.h b/src/afsweb/apache_includes/1.2/conf.h index c7a7d75..ee6f0be 100644 --- a/src/afsweb/apache_includes/1.2/conf.h +++ b/src/afsweb/apache_includes/1.2/conf.h @@ -87,7 +87,9 @@ char *mktemp(char *template); #include #define NEED_STRERROR typedef int rlim_t; -#define memmove(a,b,c) bcopy(b,a,c) +#ifndef HAVE_MEMMOVE +#define memmove(a,b,c) memcpy(a, b, c) +#endif #define NO_LINGCLOSE #define USE_FLOCK_SERIALIZED_ACCEPT @@ -96,7 +98,6 @@ typedef int rlim_t; #define NO_KILLPG #undef NO_SETSID #define HAVE_SYS_RESOURCE_H -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP @@ -299,7 +300,7 @@ extern int strncasecmp(const char *,const char *,unsigned); /* These are to let -Wall compile more cleanly */ extern int strcasecmp(const char *, const char *); extern int strncasecmp(const char *,const char *,unsigned); -extern int set42sig(), getopt(), getpeername(), bzero(); +extern int set42sig(), getopt(), getpeername(); extern int listen(), bind(), socket(), getsockname(); extern int accept(), gethostname(), connect(), lstat(); extern int select(), killpg(), shutdown(); @@ -335,7 +336,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT @@ -347,7 +347,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define HAVE_RESOURCE #define HAVE_MMAP @@ -364,7 +363,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT @@ -447,7 +445,6 @@ int initgroups (char *, int); #define NO_KILLPG #undef NO_SETSID #define HAVE_RESOURCE 1 -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP diff --git a/src/afsweb/apache_includes/1.3.1/ap_config.h b/src/afsweb/apache_includes/1.3.1/ap_config.h index cbb2161..d12a44b 100644 --- a/src/afsweb/apache_includes/1.3.1/ap_config.h +++ b/src/afsweb/apache_includes/1.3.1/ap_config.h @@ -141,7 +141,9 @@ char *mktemp(char *template); #include #define NEED_STRERROR typedef int rlim_t; -#define memmove(a,b,c) bcopy(b,a,c) +#ifndef HAVE_MEMMOVE +#define memmove(a,b,c) memcpy(a, b, c) +#endif #define NO_LINGCLOSE #define USE_FLOCK_SERIALIZED_ACCEPT #define NEED_DIFFTIME @@ -151,7 +153,6 @@ typedef int rlim_t; #undef HAVE_GMTOFF #define NO_KILLPG #undef NO_SETSID -#define bzero(a,b) memset(a,0,b) #if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \ !defined(USE_PTHREAD_SERIALIZED_ACCEPT) #define USE_FCNTL_SERIALIZED_ACCEPT @@ -252,7 +253,7 @@ typedef int rlim_t; #endif #define USE_FCNTL_SERIALIZED_ACCEPT #ifdef USEBCOPY -#define memmove(a,b,c) bcopy(b,a,c) +#define memmove(a,b,c) memcpy(a, b, c) #endif #if AIX >= 42 #define NET_SIZE_T size_t @@ -446,7 +447,7 @@ extern int strncasecmp(const char *, const char *, unsigned); /* These are to let -Wall compile more cleanly */ extern int strcasecmp(const char *, const char *); extern int strncasecmp(const char *, const char *, unsigned); -extern int set42sig(), getopt(), getpeername(), bzero(); +extern int set42sig(), getopt(), getpeername(); extern int listen(), bind(), socket(), getsockname(); extern int accept(), gethostname(), connect(), lstat(); extern int select(), killpg(), shutdown(); @@ -489,7 +490,6 @@ extern char *crypt(); #define NEED_STRNCASECMP #endif /* ENCORE */ #endif /* MPRAS */ -#define bzero(a,b) memset(a,0,b) /* A lot of SVR4 systems need this */ #ifndef USE_SYSVSEM_SERIALIZED_ACCEPT #define USE_FCNTL_SERIALIZED_ACCEPT @@ -513,7 +513,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define HAVE_MMAP 1 #define USE_MMAP_SCOREBOARD #define USE_MMAP_FILES @@ -533,7 +532,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT #define ap_inet_addr inet_network @@ -653,7 +651,6 @@ typedef int rlim_t; #undef HAVE_GMTOFF #define NO_KILLPG #undef NO_SETSID -#define bzero(a,b) memset(a,0,b) #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP 1 #define USE_MMAP_SCOREBOARD diff --git a/src/afsweb/apache_includes/1.3.6/ap_config.h b/src/afsweb/apache_includes/1.3.6/ap_config.h index 81f8906..a33d563 100644 --- a/src/afsweb/apache_includes/1.3.6/ap_config.h +++ b/src/afsweb/apache_includes/1.3.6/ap_config.h @@ -166,7 +166,9 @@ char *mktemp(char *template); #include #define NEED_STRERROR typedef int rlim_t; -#define memmove(a,b,c) bcopy(b,a,c) +#ifndef HAVE_MEMMOVE +#define memmove(a,b,c) memcpy(a, b, c) +#endif #define NO_LINGCLOSE #define USE_FLOCK_SERIALIZED_ACCEPT #define NEED_DIFFTIME @@ -176,7 +178,6 @@ typedef int rlim_t; #undef HAVE_GMTOFF #define NO_KILLPG #undef NO_SETSID -#define bzero(a,b) memset(a,0,b) #if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \ !defined(USE_PTHREAD_SERIALIZED_ACCEPT) #define USE_FCNTL_SERIALIZED_ACCEPT @@ -277,7 +278,7 @@ typedef int rlim_t; #endif #define USE_FCNTL_SERIALIZED_ACCEPT #ifdef USEBCOPY -#define memmove(a,b,c) bcopy(b,a,c) +#define memmove(a,b,c) memcpy(a, b, c) #endif #if AIX >= 42 #define NET_SIZE_T size_t @@ -517,7 +518,7 @@ extern int strncasecmp(const char *, const char *, unsigned); /* These are to let -Wall compile more cleanly */ extern int strcasecmp(const char *, const char *); extern int strncasecmp(const char *, const char *, unsigned); -extern int set42sig(), getopt(), getpeername(), bzero(); +extern int set42sig(), getopt(), getpeername(); extern int listen(), bind(), socket(), getsockname(); extern int accept(), gethostname(), connect(), lstat(); extern int select(), killpg(), shutdown(); @@ -560,7 +561,6 @@ extern char *crypt(); #define NEED_STRNCASECMP #endif /* ENCORE */ #endif /* MPRAS */ -#define bzero(a,b) memset(a,0,b) /* A lot of SVR4 systems need this */ #ifndef USE_SYSVSEM_SERIALIZED_ACCEPT #define USE_FCNTL_SERIALIZED_ACCEPT @@ -589,7 +589,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define HAVE_MMAP 1 #define USE_MMAP_SCOREBOARD #define USE_MMAP_FILES @@ -613,7 +612,6 @@ extern char *crypt(); #define NEED_STRCASECMP #define NEED_STRNCASECMP #endif -#define bzero(a,b) memset(a,0,b) /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT #define ap_inet_addr inet_network @@ -737,7 +735,6 @@ typedef int rlim_t; #undef HAVE_GMTOFF #define NO_KILLPG #undef NO_SETSID -#define bzero(a,b) memset(a,0,b) #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP 1 #define USE_MMAP_SCOREBOARD diff --git a/src/afsweb/apache_includes/conf.h b/src/afsweb/apache_includes/conf.h index c7a7d75..ee6f0be 100644 --- a/src/afsweb/apache_includes/conf.h +++ b/src/afsweb/apache_includes/conf.h @@ -87,7 +87,9 @@ char *mktemp(char *template); #include #define NEED_STRERROR typedef int rlim_t; -#define memmove(a,b,c) bcopy(b,a,c) +#ifndef HAVE_MEMMOVE +#define memmove(a,b,c) memcpy(a, b, c) +#endif #define NO_LINGCLOSE #define USE_FLOCK_SERIALIZED_ACCEPT @@ -96,7 +98,6 @@ typedef int rlim_t; #define NO_KILLPG #undef NO_SETSID #define HAVE_SYS_RESOURCE_H -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP @@ -299,7 +300,7 @@ extern int strncasecmp(const char *,const char *,unsigned); /* These are to let -Wall compile more cleanly */ extern int strcasecmp(const char *, const char *); extern int strncasecmp(const char *,const char *,unsigned); -extern int set42sig(), getopt(), getpeername(), bzero(); +extern int set42sig(), getopt(), getpeername(); extern int listen(), bind(), socket(), getsockname(); extern int accept(), gethostname(), connect(), lstat(); extern int select(), killpg(), shutdown(); @@ -335,7 +336,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT @@ -347,7 +347,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define HAVE_RESOURCE #define HAVE_MMAP @@ -364,7 +363,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT @@ -447,7 +445,6 @@ int initgroups (char *, int); #define NO_KILLPG #undef NO_SETSID #define HAVE_RESOURCE 1 -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP diff --git a/src/afsweb/weblog.c b/src/afsweb/weblog.c index fd1548b..4f49722 100644 --- a/src/afsweb/weblog.c +++ b/src/afsweb/weblog.c @@ -338,7 +338,7 @@ static int store_afs_token(unix_id, realm_p, tkt_type, ticket_p, ticket_len, token.startTime = starttime; token.endTime = endtime; - bcopy(session_key, (char *) &token.sessionKey, sizeof(token.sessionKey)); + memcpy((char *) &token.sessionKey, session_key, sizeof(token.sessionKey)); token.kvno = tkt_type; token.ticketLen = ticket_len; if (ticket_len > MAXKTCTICKETLEN) { @@ -346,7 +346,7 @@ static int store_afs_token(unix_id, realm_p, tkt_type, ticket_p, ticket_len, "Maximum length accepted by AFS cache manager is %d\n", MAXKTCTICKETLEN); return -1; } - bcopy((char *) ticket_p, (char *) token.ticket, ticket_len); + memcpy((char *) token.ticket, (char *) ticket_p, ticket_len); sprintf(client.name, "AFS ID %d", unix_id); strcpy(client.instance, ""); @@ -370,7 +370,7 @@ static char *make_string(s_p, length) fprintf(stderr, "dlog: out of memory\n"); exit(1); } - bcopy(s_p, new_p, length); + memcpy(new_p, s_p, length); new_p[length] = '\0'; return new_p; } @@ -493,7 +493,7 @@ static int decode_reply(buf, buflen, reply_p) case ASN_OCTET_STRING: if (context == 1 && len == sizeof(reply_p->session_key)) { saw_session_key++; - bcopy(buf, reply_p->session_key, len); + memcpy(reply_p->session_key, buf, len); } buf += len; break; @@ -710,7 +710,7 @@ static int getDFScreds(char *name, char *realm, char *passwd, des_string_to_key(passwd, passwd_key); /* Destroy the password. */ - bzero(passwd, strlen(passwd)); + memset(passwd, 0, strlen(passwd)); /* @@ -731,8 +731,8 @@ static int getDFScreds(char *name, char *realm, char *passwd, /* * Destroy the key block: it's no longer needed. */ - bzero(schedule, sizeof(schedule)); - bzero(passwd_key, sizeof(passwd_key)); + memset(schedule, 0, sizeof(schedule)); + memset(passwd_key, 0, sizeof(passwd_key)); /* @@ -811,7 +811,7 @@ CommandProc (as, arock) char type[10]; /* authentication type AFS or DFS */ /* blow away command line arguments */ - for (i=1; iAFSCBFids_len) { *((u_int *)bufferPtr) = Fids->AFSCBFids_len; bufferPtr += sizeof(u_int); - bcopy(Fids->AFSCBFids_val, bufferPtr, sizeof(struct AFSFid)); + memcpy(bufferPtr, Fids->AFSCBFids_val, sizeof(struct AFSFid)); } else { struct AFSFid dummy; *((u_int *)bufferPtr) = 0; bufferPtr += sizeof(u_int); - bzero (bufferPtr, sizeof(struct AFSFid)); + memset(bufferPtr, 0, sizeof(struct AFSFid)); } bufferPtr += sizeof(struct AFSFid); break; diff --git a/src/auth/cellconfig.c b/src/auth/cellconfig.c index 49b5643..97e0b20 100644 --- a/src/auth/cellconfig.c +++ b/src/auth/cellconfig.c @@ -224,7 +224,7 @@ register char *adir; { LOCK_GLOBAL_MUTEX /* zero structure and fill in name; rest is done by internal routine */ tdir = (struct afsconf_dir *) malloc(sizeof(struct afsconf_dir)); - bzero(tdir, sizeof(struct afsconf_dir)); + memset(tdir, 0, sizeof(struct afsconf_dir)); tdir->name = (char *) malloc(strlen(adir)+1); strcpy(tdir->name, adir); @@ -401,7 +401,7 @@ char clones[]; curEntry = 0; } curEntry = (struct afsconf_entry *) malloc(sizeof(struct afsconf_entry)); - bzero(curEntry, sizeof(struct afsconf_entry)); + memset(curEntry, 0, sizeof(struct afsconf_entry)); code = ParseCellLine(tbuffer, curEntry->cellInfo.name, linkedcell); if (code) { afsconf_CloseInternal(adir); @@ -781,7 +781,7 @@ register struct afsconf_dir *adir; { if (adir->keystr) free(adir->keystr); /* reinit */ - bzero(adir, sizeof(struct afsconf_dir)); + memset(adir, 0, sizeof(struct afsconf_dir)); adir->name = tname; /* restore it */ return 0; } @@ -858,7 +858,7 @@ struct afsconf_keys *astr; code = afsconf_Check(adir); if (code) return AFSCONF_FAILURE; - bcopy(adir->keystr, astr, sizeof(struct afsconf_keys)); + memcpy(astr, adir->keystr, sizeof(struct afsconf_keys)); UNLOCK_GLOBAL_MUTEX return 0; } @@ -892,7 +892,7 @@ afs_int32 afsconf_GetLatestKey(adir, avno, akey) } } if (bestk) { /* found any */ - if (akey) bcopy(bestk->key, akey, 8); /* copy out latest key */ + if (akey) memcpy(akey, bestk->key, 8); /* copy out latest key */ if (avno) *avno = bestk->kvno; /* and kvno to caller */ UNLOCK_GLOBAL_MUTEX return 0; @@ -919,7 +919,7 @@ char *akey; for(tk = adir->keystr->key,i=0;ikvno == avno) { - bcopy(tk->key, akey, 8); + memcpy(akey, tk->key, 8); UNLOCK_GLOBAL_MUTEX return 0; } @@ -938,7 +938,7 @@ struct afsconf_dir *adir; register afs_int32 i; char tbuffer[256]; - bcopy(adir->keystr, &tkeys, sizeof(struct afsconf_keys)); + memcpy(&tkeys, adir->keystr, sizeof(struct afsconf_keys)); /* convert it to net byte order */ for(i = 0; ikey[tk->nkeys++]; } tkey->kvno = akvno; - bcopy(akey, tkey->key, 8); + memcpy(tkey->key, akey, 8); i = SaveKeys(adir); afsconf_Touch(adir); UNLOCK_GLOBAL_MUTEX @@ -1032,7 +1032,7 @@ afs_int32 akvno; /* otherwise slide the others down. i and tkey point at the guy to delete */ for(;inkeys-1; i++,tkey++) { tkey->kvno = (tkey+1)->kvno; - bcopy((tkey+1)->key, tkey->key, 8); + memcpy(tkey->key, (tkey+1)->key, 8); } tk->nkeys--; i = SaveKeys(adir); diff --git a/src/auth/ktc.c b/src/auth/ktc.c index 1fc6428..a4ad0bb 100644 --- a/src/auth/ktc.c +++ b/src/auth/ktc.c @@ -275,7 +275,7 @@ afs_int32 flags; else /* valid, but no match */ ; } else found = i; /* remember this empty slot */ if (found == -1) return KTC_NOENT; - bcopy (atoken, &local_tokens[found].token, sizeof(struct ktc_token)); + memcpy(&local_tokens[found].token, atoken, sizeof(struct ktc_token)); local_tokens[found].server = *aserver; local_tokens[found].client = *aclient; local_tokens[found].valid = 1; @@ -284,13 +284,13 @@ afs_int32 flags; tp = tbuffer; /* start copying here */ if ((atoken->ticketLen < MINKTCTICKETLEN) || (atoken->ticketLen > MAXKTCTICKETLEN)) return KTC_TOOBIG; - bcopy(&atoken->ticketLen, tp, sizeof(afs_int32)); /* copy in ticket length */ + memcpy(tp, &atoken->ticketLen, sizeof(afs_int32)); /* copy in ticket length */ tp += sizeof(afs_int32); - bcopy(atoken->ticket, tp, atoken->ticketLen); /* copy in ticket */ + memcpy(tp, atoken->ticket, atoken->ticketLen); /* copy in ticket */ tp += atoken->ticketLen; /* next, copy in the "clear token", describing who we are */ ct.AuthHandle = atoken->kvno; /* hide auth handle here */ - bcopy(&atoken->sessionKey, ct.HandShakeKey, 8); + memcpy(ct.HandShakeKey, &atoken->sessionKey, 8); ct.BeginTimestamp = atoken->startTime; ct.EndTimestamp = atoken->endTime; @@ -326,9 +326,9 @@ not_vice_id: #endif temp = sizeof(struct ClearToken); - bcopy(&temp, tp, sizeof(afs_int32)); + memcpy(tp, &temp, sizeof(afs_int32)); tp += sizeof(afs_int32); - bcopy(&ct, tp, sizeof(struct ClearToken)); + memcpy(tp, &ct, sizeof(struct ClearToken)); tp += sizeof(struct ClearToken); /* next copy in primary flag */ @@ -344,7 +344,7 @@ not_vice_id: if (flags & AFS_SETTOK_SETPAG) temp |= 0x8000; - bcopy(&temp, tp, sizeof(afs_int32)); + memcpy(tp, &temp, sizeof(afs_int32)); tp += sizeof(afs_int32); /* finally copy in the cell name */ @@ -478,7 +478,7 @@ struct ktc_token *atoken; { (strcmp (local_tokens[i].server.name, aserver->name) == 0) && (strcmp (local_tokens[i].server.instance, aserver->instance) == 0) && (strcmp (local_tokens[i].server.cell, aserver->cell) == 0)) { - bcopy (&local_tokens[i].token, atoken, min (atokenLen, sizeof(struct ktc_token))); + memcpy (atoken, &local_tokens[i].token, min (atokenLen, sizeof(struct ktc_token))); if (aclient) *aclient = local_tokens[i].client; UNLOCK_GLOBAL_MUTEX @@ -508,7 +508,7 @@ struct ktc_token *atoken; { if (aclient) strcpy(aclient->cell, lcell); - bcopy(&ctoken, atoken, + memcpy(atoken, &ctoken, min (atokenLen, sizeof(struct ktc_token))); afs_tf_close(); @@ -762,10 +762,10 @@ struct ktc_principal *aserver; { /* next iterator determined by earlier loop */ *aindex = index+1; - bcopy(tp, &temp, sizeof(afs_int32)); /* get size of secret token */ + memcpy(&temp, tp, sizeof(afs_int32)); /* get size of secret token */ tp += sizeof(afs_int32); tp += temp; /* skip ticket for now */ - bcopy(tp, &temp, sizeof(afs_int32)); /* get size of clear token */ + memcpy(&temp, tp, sizeof(afs_int32)); /* get size of clear token */ if (temp != sizeof(struct ClearToken)) { UNLOCK_GLOBAL_MUTEX return KTC_ERROR; @@ -1164,7 +1164,7 @@ afs_tf_close() (void) close(fd); fd = -1; /* see declaration of fd above */ } - bzero(tfbfr, sizeof(tfbfr)); + memset(tfbfr, 0, sizeof(tfbfr)); } /* @@ -1446,7 +1446,7 @@ afs_tf_create(pname,pinst) if ((fd = open(file, O_RDWR, 0)) < 0) goto out; /* can't zero it, but we can still try truncating it */ - bzero(zerobuf, sizeof(zerobuf)); + memset(zerobuf, 0, sizeof(zerobuf)); for (i = 0; i < sbuf.st_size; i += sizeof(zerobuf)) if (write(fd, zerobuf, sizeof(zerobuf)) != sizeof(zerobuf)) { @@ -1517,7 +1517,7 @@ afs_tf_dest_tkt() if ((fd = open(file, O_RDWR, 0)) < 0) goto out; - bzero(buf, BUFSIZ); + memset(buf, 0, BUFSIZ); for (i = 0; i < statb.st_size; i += BUFSIZ) if (write(fd, buf, BUFSIZ) != BUFSIZ) { diff --git a/src/auth/setkey.c b/src/auth/setkey.c index fe05205..df8437e 100644 --- a/src/auth/setkey.c +++ b/src/auth/setkey.c @@ -77,7 +77,7 @@ char **argv; { printf(" Ex: setkey add 0 \"80b6a7cd7a9dadb6\"\n"); exit(1); } - bzero(tkey, sizeof(tkey)); + memset(tkey, 0, sizeof(tkey)); for(i=7, cp = argv[3] + 15;i>=0; i--,cp-=2) tkey[i] = char2hex(*cp) + char2hex(*(cp-1))*16; @@ -115,7 +115,7 @@ char **argv; { char hexbuf[17]; unsigned char c; int j; - bcopy(tkeys.key[i].key, tbuffer, 8); + memcpy(tbuffer, tkeys.key[i].key, 8); tbuffer[8] = 0; for(j=0;j<8;j++) { c = tbuffer[j]; diff --git a/src/auth/test/testcellconf.c b/src/auth/test/testcellconf.c index 9fb64e1..15a44856 100644 --- a/src/auth/test/testcellconf.c +++ b/src/auth/test/testcellconf.c @@ -48,7 +48,7 @@ struct afsconf_dir *adir; { printf("Cell %s:\n", ainfo->name); for(i=0;inumServers;i++) { - bcopy(&ainfo->hostAddr[i].sin_addr, &temp, sizeof(long)); + memcpy(&temp, &ainfo->hostAddr[i].sin_addr, sizeof(long)); printf(" host %s at %x.%x\n", ainfo->hostName[i], temp, ainfo->hostAddr[i].sin_port); } return 0; diff --git a/src/auth/writeconfig.c b/src/auth/writeconfig.c index 6db69c7..e5b08b0 100644 --- a/src/auth/writeconfig.c +++ b/src/auth/writeconfig.c @@ -51,7 +51,7 @@ register struct afsconf_cell *aci; { printf("Host %s not found in host database...\n", aci->hostName[i]); return AFSCONF_FAILURE; } - bcopy(th->h_addr, &aci->hostAddr[i].sin_addr, sizeof(afs_int32)); + memcpy(&aci->hostAddr[i].sin_addr, th->h_addr, sizeof(afs_int32)); } /* otherwise we're deleting this entry */ } diff --git a/src/bozo/bnode.c b/src/bozo/bnode.c index 3ac99c8..b52f566 100644 --- a/src/bozo/bnode.c +++ b/src/bozo/bnode.c @@ -281,7 +281,7 @@ struct bnode_ops *aprocs; { } if (!tt) { tt = (struct bnode_type *) malloc(sizeof(struct bnode_type)); - bzero(tt, sizeof(struct bnode_type)); + memset(tt, 0, sizeof(struct bnode_type)); tt->next = allTypes; allTypes = tt; tt->name = atype; @@ -425,7 +425,7 @@ struct bnode_ops *abnodeops; { struct bnode **lb, *nb; /* format the bnode properly */ - bzero(abnode, sizeof(struct bnode)); + memset(abnode, 0, sizeof(struct bnode)); abnode->ops = abnodeops; abnode->name = (char *) malloc(strlen(aname)+1); strcpy(abnode->name, aname); @@ -733,13 +733,13 @@ int bnode_Init() { if (initDone) return 0; initDone = 1; - bzero(&bnode_stats, sizeof(bnode_stats)); + memset(&bnode_stats, 0, sizeof(bnode_stats)); LWP_InitializeProcessSupport(1, &junk); /* just in case */ IOMGR_Initialize(); code = LWP_CreateProcess(bproc, BNODE_LWP_STACKSIZE, /* priority */ 1, /* parm */0, "bnode-manager", &bproc_pid); if (code) return code; - bzero((char *)&newaction, sizeof(newaction)); + memset((char *)&newaction, 0, sizeof(newaction)); newaction.sa_handler = bnode_Int; code = sigaction(SIGCHLD, &newaction, NULL); if (code) return errno; @@ -831,7 +831,7 @@ char *aexecString; { code = bnode_ParseLine(aexecString, &tlist); /* try parsing first */ if (code) return code; tp = (struct bnode_proc *) malloc(sizeof(struct bnode_proc)); - bzero(tp, sizeof(struct bnode_proc)); + memset(tp, 0, sizeof(struct bnode_proc)); tp->next = allProcs; allProcs = tp; *aproc = tp; diff --git a/src/bozo/bos.c b/src/bozo/bos.c index 936dba3..ce0d0a3 100644 --- a/src/bozo/bos.c +++ b/src/bozo/bos.c @@ -178,7 +178,7 @@ struct cmd_syndesc *as; { printf("bos: can't find address for host '%s'\n", hostname); exit(1); } - bcopy(th->h_addr, &addr, sizeof(afs_int32)); + memcpy(&addr, th->h_addr, sizeof(afs_int32)); /* get tokens for making authenticated connections */ localauth = (as->parms[ADDPARMOFFSET + 2].items != 0); @@ -289,7 +289,7 @@ afs_int32 alen; { register char *tp; strcpy(aresult, adir); - tp = rindex(aname, '/'); + tp = strrchr(aname, '/'); if (!tp) { /* no '/' in name */ strcat(aresult, "/"); @@ -785,7 +785,7 @@ register struct cmd_syndesc *as; { char buf[BUFSIZ], ver[BUFSIZ]; tconn = GetConn(as, 1); - bzero(&tkey, sizeof(struct ktc_encryptionKey)); + memset(&tkey, 0, sizeof(struct ktc_encryptionKey)); if(as->parms[1].items) strcpy(buf,as->parms[1].items->data); @@ -1350,7 +1350,7 @@ struct cmd_syndesc *as; { char *orphans; char *tp; - bzero(&mrafsParm, sizeof(mrafsParm)); + memset(&mrafsParm, 0, sizeof(mrafsParm)); /* parm 0 is machine name, 1 is partition, 2 is volume, 3 is -all flag */ tconn = GetConn(as, 0); diff --git a/src/bozo/bosoprocs.c b/src/bozo/bosoprocs.c index 25c41af..c3aa5d5 100644 --- a/src/bozo/bosoprocs.c +++ b/src/bozo/bosoprocs.c @@ -60,11 +60,11 @@ struct ktime *aktime; { code = 0; /* assume success */ switch (atype) { case 1: - bcopy(&bozo_nextRestartKT, aktime, sizeof(struct ktime)); + memcpy(aktime, &bozo_nextRestartKT, sizeof(struct ktime)); break; case 2: - bcopy(&bozo_nextDayKT, aktime, sizeof(struct ktime)); + memcpy(aktime, &bozo_nextDayKT, sizeof(struct ktime)); break; default: @@ -92,11 +92,11 @@ struct ktime *aktime; { code = 0; /* assume success */ switch (atype) { case 1: - bcopy(aktime, &bozo_nextRestartKT, sizeof(struct ktime)); + memcpy(&bozo_nextRestartKT, aktime, sizeof(struct ktime)); break; case 2: - bcopy(aktime, &bozo_nextDayKT, sizeof(struct ktime)); + memcpy(&bozo_nextDayKT, aktime, sizeof(struct ktime)); break; default: @@ -472,8 +472,8 @@ char *aname; { goto fail; } - bzero(&tcell.hostAddr[which], sizeof(struct sockaddr_in)); - bzero(tcell.hostName[which], MAXHOSTCHARS); + memset(&tcell.hostAddr[which], 0, sizeof(struct sockaddr_in)); + memset(tcell.hostName[which], 0, MAXHOSTCHARS); code = afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH, &tcell); fail: @@ -534,7 +534,7 @@ char *aname; { } } - bzero(&tcell.hostAddr[which], sizeof(struct sockaddr_in)); + memset(&tcell.hostAddr[which], 0, sizeof(struct sockaddr_in)); strcpy(tcell.hostName[which], aname); code = afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH, &tcell); @@ -572,7 +572,7 @@ struct bozo_key *akey; goto fail; } *akvno = tkeys.key[an].kvno; - bzero(akeyinfo, sizeof(struct bozo_keyInfo)); + memset(akeyinfo, 0, sizeof(struct bozo_keyInfo)); noauth = afsconf_GetNoAuthFlag(bozo_confdir); rxkad_GetServerInfo(acall->conn, &enc_level, 0, 0, 0, 0, 0); @@ -581,9 +581,9 @@ struct bozo_key *akey; */ if ((noauth) || (enc_level == rxkad_crypt)) { - bcopy(tkeys.key[an].key, akey, 8); + memcpy(akey, tkeys.key[an].key, 8); } - else bzero (akey, 8); + else memset(akey, 0, 8); code = stat(AFSDIR_SERVER_KEY_FILEPATH, &tstat); if (code == 0) { @@ -1281,7 +1281,7 @@ BOZO_GetInstanceInfo(acall, ainstance, atype, astatus) strcpy(*atype, tb->type->name); else (*atype)[0] = 0; /* null string */ - bzero(astatus, sizeof(struct bozo_status)); /* good defaults */ + memset(astatus, 0, sizeof(struct bozo_status)); /* good defaults */ astatus->goal = tb->goal; astatus->fileGoal = tb->fileGoal; astatus->procStartTime = tb->procStartTime; @@ -1316,7 +1316,7 @@ char **aparm; { bnode_Hold(tb); if (anum == 999) { if (tb->notifier) { - bcopy(tb->notifier, tp, strlen(tb->notifier)+1); + memcpy(tp, tb->notifier, strlen(tb->notifier)+1); code = 0; } else code = BZNOENT; /* XXXXX */ diff --git a/src/bozo/bosserver.c b/src/bozo/bosserver.c index 12f4077..e6a9aea 100644 --- a/src/bozo/bosserver.c +++ b/src/bozo/bosserver.c @@ -866,7 +866,7 @@ char **envp; bozo_Log("try the 'hostname' command\n"); exit(1); } - bzero(tcell.hostAddr, sizeof(tcell.hostAddr)); /* not computed */ + memset(tcell.hostAddr, 0, sizeof(tcell.hostAddr)); /* not computed */ code = afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH, &tcell); if (code) { bozo_Log("could not create cell database in '%s' (code %d), quitting\n", AFSDIR_SERVER_ETC_DIRPATH, code); diff --git a/src/bozo/cronbnodeops.c b/src/bozo/cronbnodeops.c index c686336..b410c3e 100644 --- a/src/bozo/cronbnodeops.c +++ b/src/bozo/cronbnodeops.c @@ -151,7 +151,7 @@ char *acommand; { } te = (struct cronbnode *) malloc(sizeof(struct cronbnode)); - bzero(te, sizeof(struct cronbnode)); + memset(te, 0, sizeof(struct cronbnode)); code = ktime_ParsePeriodic(awhen, &te->whenToRun); if (code < 0) { free(te); diff --git a/src/bozo/ezbnodeops.c b/src/bozo/ezbnodeops.c index 7989d25..75e6261 100644 --- a/src/bozo/ezbnodeops.c +++ b/src/bozo/ezbnodeops.c @@ -91,7 +91,7 @@ char *acommand; { } te = (struct ezbnode *) malloc(sizeof(struct ezbnode)); - bzero(te, sizeof(struct ezbnode)); + memset(te, 0, sizeof(struct ezbnode)); bnode_InitBnode(te, &ezbnode_ops, ainstance); te->command = cmdpath; return (struct bnode *) te; diff --git a/src/bozo/fsbnodeops.c b/src/bozo/fsbnodeops.c index 4c74be7..26670d5 100644 --- a/src/bozo/fsbnodeops.c +++ b/src/bozo/fsbnodeops.c @@ -342,7 +342,7 @@ char *ascancmd; { } te = (struct fsbnode *) malloc(sizeof(struct fsbnode)); - bzero(te, sizeof(struct fsbnode)); + memset(te, 0, sizeof(struct fsbnode)); te->filecmd = fileCmdpath; te->volcmd = volCmdpath; te->salcmd = salCmdpath; diff --git a/src/bu_utils/fms.c b/src/bu_utils/fms.c index 8caaa8e..33c8f07 100644 --- a/src/bu_utils/fms.c +++ b/src/bu_utils/fms.c @@ -58,7 +58,7 @@ main(argc, argv) struct sigaction intaction, oldaction; struct cmd_syndesc *cptr; - bzero((char *)&intaction, sizeof(intaction)); + memset((char *)&intaction, 0, sizeof(intaction)); intaction.sa_handler = (int (*)())quitFms; sigaction(SIGINT, &intaction, &oldaction); @@ -280,7 +280,7 @@ dataBlock(usd_handle_t hTape, afs_int32 reqSize) if ( dB_buffer == 0 ) ERROR(-1); dB_buffersize = reqSize; - bzero(dB_buffer, dB_buffersize); + memset(dB_buffer, 0, dB_buffersize); } ptr = (int *) dB_buffer; diff --git a/src/bucoord/commands.c b/src/bucoord/commands.c index 7550ac8..bf13cab 100644 --- a/src/bucoord/commands.c +++ b/src/bucoord/commands.c @@ -125,7 +125,7 @@ afs_int32 getSPEntries(server, partition, serverlist, ss, ps) *ss = 0; return(BC_NOMEM); } - bzero(*ss, sizeof(struct serversort)); + memset(*ss, 0, sizeof(struct serversort)); (*ss)->ipaddr = server; (*ss)->next = *serverlist; *serverlist = *ss; @@ -148,7 +148,7 @@ afs_int32 getSPEntries(server, partition, serverlist, ss, ps) *ss = 0; return(BC_NOMEM); } - bzero(*ps, sizeof(struct partitionsort)); + memset(*ps, 0, sizeof(struct partitionsort)); (*ps)->part = partition; (*ps)->next = (*ss)->partitions; (*ss)->partitions = *ps; @@ -305,7 +305,7 @@ int EvalVolumeSet2(aconfig, avs, avols, uclient) com_err(whoami, BC_NOMEM, ""); ERROR(BC_NOMEM); } - bzero(tvd, sizeof(*tvd)); + memset(tvd, 0, sizeof(*tvd)); tvd->name = (char *) malloc(strlen(entries[e].name)+10); if (!(tvd->name)) { @@ -428,7 +428,7 @@ int EvalVolumeSet1(aconfig, avs, avols, uclient) */ for (index=0; 1; index=next_index) { /*w*/ - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry, /*Routine to invoke*/ uclient, /*Ubik client structure*/ 0, /*Ubik flags*/ @@ -551,7 +551,7 @@ int EvalVolumeSet1(aconfig, avs, avols, uclient) com_err(whoami, BC_NOMEM,""); return(BC_NOMEM); } - bzero(tvd, sizeof(*tvd)); + memset(tvd, 0, sizeof(*tvd)); tvd->name = (char *) malloc(strlen(entry.name)+10); if (!(tvd->name)) @@ -1044,7 +1044,7 @@ bc_KillCmd(as, arock) tp = as->parms[0].items->data; - if (index(tp, '.') == 0) + if (strchr(tp, '.') == 0) { slot = bc_SafeATOI(tp); if (slot == -1) @@ -1181,7 +1181,7 @@ bc_VolRestoreCmd(as, arock) com_err(whoami,BC_NOMEM,""); return BC_NOMEM; } - bzero(tvol, sizeof(struct bc_volumeDump)); + memset(tvol, 0, sizeof(struct bc_volumeDump)); tvol->name = (char *) malloc(VOLSER_MAXVOLNAME +1); if (!tvol->name) @@ -1301,8 +1301,8 @@ char *arock; { } /* create a volume set corresponding to the volume pattern we've been given */ - bzero(&tvolumeSet, sizeof(tvolumeSet)); - bzero(&tvolumeEntry, sizeof(tvolumeEntry)); + memset(&tvolumeSet, 0, sizeof(tvolumeSet)); + memset(&tvolumeEntry, 0, sizeof(tvolumeEntry)); tvolumeSet.name = "TempVolumeSet"; tvolumeSet.ventries = &tvolumeEntry; tvolumeEntry.serverName = as->parms[0].items->data; @@ -1331,7 +1331,7 @@ char *arock; { } } else /* use destination host == original host */ - bcopy(&tvolumeEntry.server, &destServ, sizeof(destServ)); + memcpy(&destServ, &tvolumeEntry.server, sizeof(destServ)); /* specified other destination partition */ if (as->parms[9].items) @@ -1515,7 +1515,7 @@ bc_VolsetRestoreCmd (as, arock) /* Allocate a volumeDump structure and link it in */ tvol = (struct bc_volumeDump *) malloc(sizeof(struct bc_volumeDump)); - bzero(tvol, sizeof(struct bc_volumeDump)); + memset(tvol, 0, sizeof(struct bc_volumeDump)); tvol->name = (char *) malloc(VOLSER_MAXVOLNAME+1); if (!tvol->name) @@ -1524,7 +1524,7 @@ bc_VolsetRestoreCmd (as, arock) return BC_NOMEM; } strncpy(tvol->name, volume, VOLSER_OLDMAXVOLNAME); - bcopy(&destServer, &tvol->server, sizeof(destServer)); + memcpy(&tvol->server, &destServer, sizeof(destServer)); tvol->partition = destPartition; if (lastVol) lastVol->next = tvol; /* thread onto end of list */ @@ -1904,7 +1904,7 @@ int bc_DumpCmd(as, arock) if (parent) problemFindingDump = 1; parent = dumpEntry.id; level = dumpEntry.level+1; - bcopy(&dumpEntry, &fde, sizeof(dumpEntry)); + memcpy(&fde, &dumpEntry, sizeof(dumpEntry)); } else { /* Dump hierarchy not complete so can't base off the latest */ @@ -2763,7 +2763,7 @@ DBLookupByVolume(volumeName) tempPtr = (struct dumpedVol *) malloc(sizeof(struct dumpedVol)); if (!tempPtr) ERROR(BC_NOMEM); - bzero(tempPtr, sizeof(*tempPtr)); + memset(tempPtr, 0, sizeof(*tempPtr)); tempPtr->incTime = volumeEntry[i].clone; tempPtr->dumpID = volumeEntry[i].dump; strncpy(tempPtr->tapeName, volumeEntry[i].tape, BU_MAXTAPELEN); @@ -2925,7 +2925,7 @@ dumpInfo(dumpid, detailFlag) ERROR(BC_NOMEM); } - bzero(tapeLinkPtr, sizeof(*tapeLinkPtr)); + memset(tapeLinkPtr, 0, sizeof(*tapeLinkPtr)); code = bcdb_FindTapeSeq(dumpid, tapeNumber, &tapeLinkPtr->tapeEntry); if (code) { @@ -2987,10 +2987,9 @@ dumpInfo(dumpid, detailFlag) com_err(whoami,BC_NOMEM,""); ERROR(BC_NOMEM); } - bzero(volumeLinkPtr, sizeof(*volumeLinkPtr)); + memset(volumeLinkPtr, 0, sizeof(*volumeLinkPtr)); - bcopy(&vl.budb_volumeList_val[i], &volumeLinkPtr->volumeEntry, - sizeof(struct budb_volumeEntry)); + memcpy(&volumeLinkPtr->volumeEntry, &vl.budb_volumeList_val[i], sizeof(struct budb_volumeEntry)); /* now insert it onto the right place */ while ( (*link != 0) && diff --git a/src/bucoord/config.c b/src/bucoord/config.c index 57d49b0..a2aafe2 100644 --- a/src/bucoord/config.c +++ b/src/bucoord/config.c @@ -72,7 +72,7 @@ bc_InitConfig(apath) if (!tb) return(BC_NOMEM); bc_globalConfig = tb; - bzero(tb, sizeof(struct bc_config)); + memset(tb, 0, sizeof(struct bc_config)); tb->path = (char *) malloc(strlen(apath)+1); if (!tb->path) { @@ -108,13 +108,13 @@ char *aname; { /* tlast now points to the next pointer (or head pointer) we should overwrite */ tentry = (struct bc_hostEntry *) malloc(sizeof(struct bc_hostEntry)); - bzero(tentry, sizeof(*tentry)); + memset(tentry, 0, sizeof(*tentry)); tentry->name = (char *) malloc(strlen(aname)+1); strcpy(tentry->name, aname); *tlast = tentry; tentry->next = (struct bc_hostEntry *) 0; tentry->addr.sin_family = AF_INET; - bcopy(th->h_addr, &tentry->addr.sin_addr.s_addr, sizeof(afs_int32)); + memcpy(&tentry->addr.sin_addr.s_addr, th->h_addr, sizeof(afs_int32)); tentry->addr.sin_port = 0; tentry->portOffset = aport; return 0; diff --git a/src/bucoord/dsstub.c b/src/bucoord/dsstub.c index f47aae3..7f81dec 100644 --- a/src/bucoord/dsstub.c +++ b/src/bucoord/dsstub.c @@ -177,7 +177,7 @@ tailCompPtr(pathNamePtr) char *pathNamePtr; { char *ptr; - ptr = rindex(pathNamePtr, '/'); + ptr = strrchr(pathNamePtr, '/'); if ( ptr == 0 ) { /* this should never happen */ diff --git a/src/bucoord/dsvs.c b/src/bucoord/dsvs.c index bba9ebb..9ed15be 100644 --- a/src/bucoord/dsvs.c +++ b/src/bucoord/dsvs.c @@ -154,9 +154,9 @@ int bc_ParseHost(aname, asockaddr) asockaddr->sin_family = AF_INET; asockaddr->sin_port = 0; addr = (b1<<24) | (b2<<16) | (b3<<8) | b4; - bcopy(&addr,&tmp1,sizeof(afs_int32)); + memcpy(&tmp1, &addr, sizeof(afs_int32)); tmp2 = htonl(tmp1); - bcopy(&tmp2, &asockaddr->sin_addr.s_addr, sizeof(afs_int32)); + memcpy(&asockaddr->sin_addr.s_addr, &tmp2, sizeof(afs_int32)); return(0); } @@ -166,7 +166,7 @@ int bc_ParseHost(aname, asockaddr) */ if (strcmp(aname, ".*") == 0) { - bzero(asockaddr, sizeof(struct sockaddr_in)); + memset(asockaddr, 0, sizeof(struct sockaddr_in)); return 0; } @@ -182,10 +182,9 @@ int bc_ParseHost(aname, asockaddr) */ asockaddr->sin_family = AF_INET; asockaddr->sin_port = 0; - bcopy(th->h_addr,&tmp1,sizeof(afs_int32)); + memcpy(&tmp1, th->h_addr, sizeof(afs_int32)); tmp2 = htonl(tmp1); - bcopy(&tmp2,&(asockaddr->sin_addr.s_addr), - sizeof(asockaddr->sin_addr.s_addr)); + memcpy(&(asockaddr->sin_addr.s_addr), &tmp2, sizeof(asockaddr->sin_addr.s_addr)); return(0); } /*bc_ParseHost*/ @@ -203,7 +202,7 @@ bc_CreateVolumeSet(aconfig, avolName, aflags) /* move to end of the list */ nset = (struct bc_volumeSet *) malloc(sizeof(struct bc_volumeSet)); - bzero(nset, sizeof(*nset)); + memset(nset, 0, sizeof(*nset)); nset->flags = aflags; nset->name = (char *) malloc(strlen(avolName)+1); strcpy(nset->name, avolName); @@ -314,7 +313,7 @@ bc_AddVolumeItem(aconfig, avolName, ahost, apart, avol) /* move to end of the list */ for(tentry = *tlast; tentry; tlast = &tentry->next, tentry = *tlast); tentry = (struct bc_volumeEntry *) malloc(sizeof(struct bc_volumeEntry)); - bzero(tentry, sizeof(*tentry)); + memset(tentry, 0, sizeof(*tentry)); tentry->serverName = (char *) malloc(strlen(ahost)+1); strcpy(tentry->serverName, ahost); tentry->partname = (char *) malloc(strlen(apart)+1); @@ -381,7 +380,7 @@ afs_int32 expType; return -2; /* name specification error */ tdump = (struct bc_dumpSchedule *) malloc(sizeof(struct bc_dumpSchedule)); - bzero(tdump, sizeof(*tdump)); + memset(tdump, 0, sizeof(*tdump)); /* prepend this node to the dump schedule list */ tdump->next = aconfig->dsched; @@ -568,7 +567,7 @@ FindDump(aconfig, nodeString, parentptr, nodeptr) matchLength = 0; curptr = &nodeString[1]; /* past first / */ - separator = index(curptr, '/'); + separator = strchr(curptr, '/'); if ( separator == 0 ) matchLength = strlen(curptr) + 1; /* +1 for leading / */ else @@ -613,7 +612,7 @@ FindDump(aconfig, nodeString, parentptr, nodeptr) return(-3); } - separator = index(curptr, '/'); + separator = strchr(curptr, '/'); if ( separator == 0 ) matchLength = strlen(&nodeString[0]); else diff --git a/src/bucoord/dump.c b/src/bucoord/dump.c index 95b9cba..b800e21 100644 --- a/src/bucoord/dump.c +++ b/src/bucoord/dump.c @@ -120,7 +120,7 @@ bc_Dumper(aindex) baseNamePtr = tailCompPtr(dumpTaskPtr->dumpName); /* setup the interface structure */ - bzero(tcdiPtr, sizeof(*tcdiPtr)); + memset(tcdiPtr, 0, sizeof(*tcdiPtr)); /* general */ strcpy(tcdiPtr->dumpPath, dumpTaskPtr->dumpName); @@ -273,7 +273,7 @@ bc_StartDmpRst(aconfig, adname, avname, avolsToDump, adestServer, adestPartition return(BC_NOTLOCKED); } - bzero(&bc_dumpTasks[i], sizeof(struct bc_dumpTask)); + memset(&bc_dumpTasks[i], 0, sizeof(struct bc_dumpTask)); bc_dumpTasks[i].callProc = aproc; bc_dumpTasks[i].config = aconfig; bc_dumpTasks[i].volumes = avolsToDump; @@ -298,9 +298,9 @@ bc_StartDmpRst(aconfig, adname, avname, avolsToDump, adestServer, adestPartition bc_dumpTasks[i].expType = dsptr->expType; } if (adestServer) - bcopy(adestServer, &bc_dumpTasks[i].destServer, sizeof(struct sockaddr_in)); + memcpy(&bc_dumpTasks[i].destServer, adestServer, sizeof(struct sockaddr_in)); else - bzero(&bc_dumpTasks[i].destServer, sizeof(struct sockaddr_in)); + memset(&bc_dumpTasks[i].destServer, 0, sizeof(struct sockaddr_in)); code = LWP_CreateProcess(bc_DmpRstStart, 20480, LWP_NORMAL_PRIORITY, i, "helper", &junk); if (code) @@ -373,7 +373,7 @@ afs_int32 size; code = ConnectButc(config, port, &tconn); if (code) return(code); - bzero(&label,sizeof(label)); + memset(&label, 0, sizeof(label)); if (afsname) strcpy(label.afsname, afsname); if (pname) @@ -421,7 +421,7 @@ bc_ReadLabel(config,port) code = ConnectButc(config, port, &tconn); if (code) return(code); - bzero(&label,sizeof(label)); + memset(&label, 0, sizeof(label)); code = TC_ReadLabel(tconn, &label, &taskId); if (code) { if (code == BUTM_NOLABEL) { diff --git a/src/bucoord/dump_sched.c b/src/bucoord/dump_sched.c index f4b0279..070c25e 100644 --- a/src/bucoord/dump_sched.c +++ b/src/bucoord/dump_sched.c @@ -394,7 +394,7 @@ bc_ParseDumpSchedule() return (BC_INTERNALERROR); } tds = (struct bc_dumpSchedule *)malloc(sizeof(struct bc_dumpSchedule)); - bzero(tds, sizeof(*tds)); + memset(tds, 0, sizeof(*tds)); tds->next = (struct bc_dumpSchedule *) 0; tds->name = (char *) malloc(strlen(dsname)+1); diff --git a/src/bucoord/expire.c b/src/bucoord/expire.c index 8ddbe86..193770a 100644 --- a/src/bucoord/expire.c +++ b/src/bucoord/expire.c @@ -63,7 +63,7 @@ LongTo_ktimeRelDate(longDate, kdptr) afs_int32 longDate; struct ktime_date *kdptr; { - bzero(kdptr, sizeof(*kdptr)); + memset(kdptr, 0, sizeof(*kdptr)); kdptr->day = longDate % (MAX_DAY_VALUE + 1); if ( kdptr->day != 0 ) @@ -264,7 +264,7 @@ ParseRelDate(dateStr, relDatePtr) afs_int32 value, digit_limit; afs_int32 type_index; - bzero(relDatePtr, sizeof(*relDatePtr)); + memset(relDatePtr, 0, sizeof(*relDatePtr)); type_index = 0; while ( 1 ) diff --git a/src/bucoord/main.c b/src/bucoord/main.c index cbbae60..8592585 100644 --- a/src/bucoord/main.c +++ b/src/bucoord/main.c @@ -195,7 +195,7 @@ bc_InitTextConfig() for ( i = 0; i < TB_NUM; i++ ) { - bzero(ctPtr, sizeof(*ctPtr)); + memset(ctPtr, 0, sizeof(*ctPtr)); ctPtr->textType = i; ctPtr->textVersion = -1; ctPtr++; diff --git a/src/bucoord/restore.c b/src/bucoord/restore.c index 49483f8..54a4ba8 100644 --- a/src/bucoord/restore.c +++ b/src/bucoord/restore.c @@ -44,10 +44,6 @@ extern void bc_HandleMisc(); extern char *whoami; extern struct rx_connection *bc_GetConn(); -#ifdef AFS_SGI64_ENV -extern char *rindex(); -#endif - #define BC_MAXLEVELS 20 #define MAXTAPESATONCE 10 @@ -139,7 +135,7 @@ extractTapeSeq(tapename) { char *sptr; - sptr = rindex(tapename, '.'); + sptr = strrchr(tapename, '.'); if ( !sptr ) return(-1); sptr++; return(atol(sptr)); @@ -277,7 +273,7 @@ bc_Restorer(aindex) com_err(whoami,BC_NOMEM,""); ERROR(BC_NOMEM); } - bzero (di, sizeof(struct dumpinfo)); + memset(di, 0, sizeof(struct dumpinfo)); di->DumpId = dumpDescr->id; di->initialDumpId = dumpDescr->initialDumpID; @@ -303,7 +299,7 @@ bc_Restorer(aindex) com_err(whoami,BC_NOMEM,""); ERROR(BC_NOMEM); } - bzero (vi, sizeof(struct volinfo)); + memset(vi, 0, sizeof(struct volinfo)); vi->volname = (char*)malloc(strlen(vname)+1); if (!vi->volname) @@ -337,7 +333,7 @@ bc_Restorer(aindex) for (di=dumpinfolist; di; di=di->next) { /* Find each of the parent dumps */ - bcopy(di, &dlevels[0], sizeof(struct dumpinfo)); + memcpy(&dlevels[0], di, sizeof(struct dumpinfo)); for (lvl=1, parent=dlevels[0].parentDumpId; parent; parent=dlevels[lvl].parentDumpId, lvl++) { @@ -479,7 +475,7 @@ bc_Restorer(aindex) com_err(whoami,BC_NOMEM,""); return(BC_NOMEM); } - bzero(tle, sizeof(struct bc_tapeList)); + memset(tle, 0, sizeof(struct bc_tapeList)); tle->tapeName = (char*)malloc(strlen(volumeEntries[ve].tape)+1); if (!tle->tapeName) @@ -531,7 +527,7 @@ bc_Restorer(aindex) com_err(whoami,BC_NOMEM,""); return(BC_NOMEM); } - bzero(ti, sizeof(struct bc_tapeItem)); + memset(ti, 0, sizeof(struct bc_tapeItem)); ti->volumeName = (char*)malloc(strlen(volumeEntries[ve].name)+1); if (!ti->volumeName) @@ -630,7 +626,7 @@ bc_Restorer(aindex) com_err(whoami,BC_NOMEM,""); ERROR(BC_NOMEM); } - bzero(tcarray, nentries*sizeof(struct tc_restoreDesc)); + memset(tcarray, 0, nentries*sizeof(struct tc_restoreDesc)); /* Fill in the array with the list above */ i = 0; diff --git a/src/bucoord/status.c b/src/bucoord/status.c index f569785..314e57e 100644 --- a/src/bucoord/status.c +++ b/src/bucoord/status.c @@ -100,7 +100,7 @@ createStatusNode() { return(0); } - bzero(ptr, sizeof(*ptr)); + memset(ptr, 0, sizeof(*ptr)); /* link it onto the chain of status entries */ ObtainWriteLock(&statusQueueLock); diff --git a/src/bucoord/tape_hosts.c b/src/bucoord/tape_hosts.c index 8306a3c..7a96a84 100644 --- a/src/bucoord/tape_hosts.c +++ b/src/bucoord/tape_hosts.c @@ -269,7 +269,7 @@ int bc_ParseHosts() the = (struct bc_hostEntry *) malloc(sizeof(struct bc_hostEntry)); if (the == (struct bc_hostEntry *)0) return (BC_NOMEM); - bzero(the, sizeof(struct bc_hostEntry)); + memset(the, 0, sizeof(struct bc_hostEntry)); if (tlast) { tlast->next = the; @@ -284,7 +284,7 @@ int bc_ParseHosts() strcpy(the->name, hostName); the->portOffset = port; if (th) { - bcopy(th->h_addr, &the->addr.sin_addr.s_addr, 4); + memcpy(&the->addr.sin_addr.s_addr, th->h_addr, 4); the->addr.sin_family = AF_INET; the->addr.sin_port = 0; } diff --git a/src/bucoord/ttest.c b/src/bucoord/ttest.c index 3b1dc84..e39495d 100644 --- a/src/bucoord/ttest.c +++ b/src/bucoord/ttest.c @@ -87,7 +87,7 @@ afs_int32 *adumpID; { printf("tape controller received request to start dump %s.\n", adumpName); *adumpID = ++transID; /* send result back to caller */ - bzero(&tdentry, sizeof(tdentry)); + memset(&tdentry, 0, sizeof(tdentry)); tdentry.created = time(0); strcpy(tdentry.name, atapeSet->format); strcat(tdentry.name, "."); @@ -111,7 +111,7 @@ afs_int32 *adumpID; { printf("created dump %d\n", tdentry.id); /* start tape (preent all fits on one tape at first */ - bzero(&ttentry, sizeof(ttentry)); + memset(&ttentry, 0, sizeof(ttentry)); sprintf(ttentry.name, tdentry.tapes.format, 1); ttentry.written = time(0); ttentry.dump = tdentry.id; /* dump we're in */ @@ -126,10 +126,10 @@ afs_int32 *adumpID; { tdescr = adumpArray->tc_dumpArray_val; for(i=0;itc_dumpArray_len;i++, tdescr++) { - bcopy(tdescr->hostID, &taddr, sizeof(taddr)); + memcpy(&taddr, tdescr->hostID, sizeof(taddr)); printf("dumping volid %s(%d) from host %08x since date %d\n", tdescr->name, tdescr->vid, taddr.sin_addr.s_addr, tdescr->date); - bzero(&tventry, sizeof(tventry)); + memset(&tventry, 0, sizeof(tventry)); strcpy(tventry.name, tdescr->name); tventry.clone = tdescr->date; tventry.seq = 0; /* frag in volume */ @@ -174,7 +174,7 @@ afs_int32 *adumpID; { printf("tape controller received request to start restore %s.\n", aname); tdescr = arestore->tc_restoreArray_val; for(i=0;itc_restoreArray_len; i++, tdescr++) { - bcopy(tdescr->hostID, &taddr, sizeof(taddr)); + memcpy(&taddr, tdescr->hostID, sizeof(taddr)); printf("restoring frag %d of volume %s from tape %s at position %d.\n New name is '%s', new vid is %d, new host is %08x, new partition is %d\n", tdescr->frag, tdescr->oldName, tdescr->tapeName, tdescr->position, tdescr->newName, tdescr->vid, taddr.sin_addr.s_addr, tdescr->partition); diff --git a/src/bucoord/ubik_db_if.c b/src/bucoord/ubik_db_if.c index 23a415b..85aee54 100644 --- a/src/bucoord/ubik_db_if.c +++ b/src/bucoord/ubik_db_if.c @@ -234,7 +234,7 @@ bcdb_FindDumpByID(dumpID, deptr) goto error; } - bcopy(dl.budb_dumpList_val, deptr, sizeof(*deptr)); + memcpy(deptr, dl.budb_dumpList_val, sizeof(*deptr)); exit: if ( dl.budb_dumpList_val ) @@ -245,7 +245,7 @@ exit: return(code); error: - bzero(deptr, sizeof(*deptr)); + memset(deptr, 0, sizeof(*deptr)); goto exit; } @@ -327,7 +327,7 @@ bcdb_FindTape(dumpid, tapeName, teptr) afs_int32 dbTime; afs_int32 code = 0; - bzero(teptr, sizeof(*teptr)); + memset(teptr, 0, sizeof(*teptr)); tl.budb_tapeList_len = 0; tl.budb_tapeList_val = 0; @@ -341,7 +341,7 @@ bcdb_FindTape(dumpid, tapeName, teptr) if (tl.budb_tapeList_len != 1) ERROR(BC_NOTUNIQUE); /* expecting a single descriptor */ - bcopy(tl.budb_tapeList_val, teptr, sizeof(*teptr)); + memcpy(teptr, tl.budb_tapeList_val, sizeof(*teptr)); error_exit: if ( tl.budb_tapeList_val ) @@ -359,7 +359,7 @@ bcdb_FindTapeSeq(dumpid, tapeSeq, teptr) afs_int32 dbTime; afs_int32 code = 0; - bzero(teptr, sizeof(*teptr)); + memset(teptr, 0, sizeof(*teptr)); tl.budb_tapeList_len = 0; tl.budb_tapeList_val = 0; @@ -372,7 +372,7 @@ bcdb_FindTapeSeq(dumpid, tapeSeq, teptr) if (tl.budb_tapeList_len != 1) ERROR(BC_NOTUNIQUE); /* expecting a single descriptor */ - bcopy(tl.budb_tapeList_val, teptr, sizeof(*teptr)); + memcpy(teptr, tl.budb_tapeList_val, sizeof(*teptr)); error_exit: if ( tl.budb_tapeList_val ) @@ -1191,14 +1191,14 @@ ubik_Call_SingleServer(aproc, aclient, aflags, p1, p2, p3, p4, p5, p6, p7, p8, p if ( code ) { /* error. Clean up single server state */ - bzero(&uServer, sizeof(uServer)); + memset(&uServer, 0, sizeof(uServer)); } return(code); } else if ( (aflags & UF_END_SINGLESERVER) != 0 ) { - bzero(&uServer, sizeof(uServer)); + memset(&uServer, 0, sizeof(uServer)); return(0); } } diff --git a/src/bucoord/vol_sets.c b/src/bucoord/vol_sets.c index fb194ff..e15ce0b 100644 --- a/src/bucoord/vol_sets.c +++ b/src/bucoord/vol_sets.c @@ -496,7 +496,7 @@ bc_ParseVolumeSet() * global configuration structure. */ tvs = (struct bc_volumeSet *) malloc(sizeof(struct bc_volumeSet)); - bzero(tvs, sizeof(*tvs)); + memset(tvs, 0, sizeof(*tvs)); tvs->name = (char *) malloc(strlen(vsname)+1); strcpy(tvs->name, vsname); @@ -531,7 +531,7 @@ bc_ParseVolumeSet() com_err(whoami,0, "Can't malloc() a new volume spec record!"); return(-1); } - bzero(tve, sizeof(*tve)); + memset(tve, 0, sizeof(*tve)); if (bc_ParseHost(serverName, &(tve->server))) com_err(whoami,0, "Can't get required info on host '%s'", serverName); diff --git a/src/budb/database.c b/src/budb/database.c index d2b2893..b98c150 100644 --- a/src/budb/database.c +++ b/src/budb/database.c @@ -44,7 +44,7 @@ afs_int32 InitDB () pollCount = 0; - bzero (&db, sizeof(db)); + memset(&db, 0, sizeof(db)); Lock_Init (&db.lock); if ((code = InitDBalloc ()) || (code = InitDBhash ())) return code; @@ -225,7 +225,7 @@ CheckInit (ut, db_init) LogDebug(0, "No data base - Building new one\n"); /* try to write a good header */ - bzero(&db.h,sizeof(db.h)); + memset(&db.h, 0, sizeof(db.h)); db.h.version = htonl(BUDB_VERSION); db.h.checkVersion = htonl(BUDB_VERSION); db.h.lastUpdate = db.h.lastDumpId = htonl(time(0)); diff --git a/src/budb/db_alloc.c b/src/budb/db_alloc.c index e785513..59f8a7f 100644 --- a/src/budb/db_alloc.c +++ b/src/budb/db_alloc.c @@ -84,7 +84,7 @@ AllocBlock (ut, block, aP) } /* clear and return the block */ - bzero (block, sizeof(*block)); + memset(block, 0, sizeof(*block)); *aP = a; return 0; } @@ -103,7 +103,7 @@ FreeBlock (ut, bh, a) dbadr a; /* db address of block */ { if (a != BlockBase(a)) db_panic ("Block addr no good"); - bzero (bh, sizeof(*bh)); + memset(bh, 0, sizeof(*bh)); bh->next = db.h.freePtrs[0]; if (set_header_word (ut, freePtrs[0], htonl(a)) || dbwrite (ut, a, (char *)bh, sizeof(*bh))) return BUDB_IO; diff --git a/src/budb/db_dump.c b/src/budb/db_dump.c index b713b2e..7776a5f 100644 --- a/src/budb/db_dump.c +++ b/src/budb/db_dump.c @@ -620,7 +620,7 @@ writeDatabase(ut, fid) /* Read the dump entry */ if (dbAddr == dbAppAddr) { /* First time through, don't need to read the dump entry again */ - bcopy(&diskDump, &apDiskDump, sizeof(diskDump)); + memcpy(&apDiskDump, &diskDump, sizeof(diskDump)); } else { if (badEntry(dbAppAddr)) { diff --git a/src/budb/db_hash.c b/src/budb/db_hash.c index 6cf2042..ad80d91 100644 --- a/src/budb/db_hash.c +++ b/src/budb/db_hash.c @@ -159,7 +159,7 @@ afs_int32 ht_AllocTable (ut, mht) mht->size = nb*sizeof(struct memoryHTBlock *); b = mht->blocks = (struct memoryHTBlock **)malloc (mht->size); - bzero (b, mht->size); + memset(b, 0, mht->size); for (i=0; i= n) db_panic ("table size inconsistent"); diff --git a/src/budb/db_text.c b/src/budb/db_text.c index 552beeb..34b831b 100644 --- a/src/budb/db_text.c +++ b/src/budb/db_text.c @@ -172,7 +172,7 @@ afs_int32 GetText (call, lockHandle, textType, maxLength, offset, textRemaining = BLOCK_DATA_SIZE - blockOffset; chunkSize = min(textRemaining, transferSize); - bcopy(&block.a[blockOffset], textPtr, chunkSize); + memcpy(textPtr, &block.a[blockOffset], chunkSize); /* LogDebug(5, "transfering %d bytes: %s\n", chunkSize, textPtr); */ @@ -400,7 +400,7 @@ afs_int32 SaveText (call, lockHandle, textType, offset, flags, charListPtr) chunkSize = MIN(remainingInBlock, textLength); /* copy in the data */ - bcopy(textptr, &diskBlock.a[offset % BLOCK_DATA_SIZE], chunkSize); + memcpy(&diskBlock.a[offset % BLOCK_DATA_SIZE], textptr, chunkSize); /* LogDebug(5, "text is %s\n", textptr); */ diff --git a/src/budb/dbs_dump.c b/src/budb/dbs_dump.c index 807a42a..462360a 100644 --- a/src/budb/dbs_dump.c +++ b/src/budb/dbs_dump.c @@ -143,7 +143,7 @@ afs_int32 DumpDB (call, firstcall, maxLength, charListPtr, done) LogDebug(5, "Setup dump\n"); /* no dump in progress - setup and retake lock */ - bzero(dumpSyncPtr, sizeof(*dumpSyncPtr)); + memset(dumpSyncPtr, 0, sizeof(*dumpSyncPtr)); /* ObtainWriteLock(&dumpSyncPtr->ds_lock); */ /* mark dump in progress */ @@ -320,7 +320,7 @@ dumpWatcher() if (code) LogError(code, "Aborting dump transaction\n"); } - bzero(dumpSyncPtr, sizeof(*dumpSyncPtr)); + memset(dumpSyncPtr, 0, sizeof(*dumpSyncPtr)); goto exit; } /*i*/ diff --git a/src/budb/ol_verify.c b/src/budb/ol_verify.c index ce257f2..b17f9b5 100644 --- a/src/budb/ol_verify.c +++ b/src/budb/ol_verify.c @@ -723,12 +723,12 @@ verifyBlocks(ut) bmsize = sizeof(*ablockMap) + (blockEntries[blocktype]-1) * sizeof(ablockMap->entries[0]); ablockMap = (struct blockMap *) malloc(bmsize); if (!ablockMap) ERROR(BUDB_NOMEM); - bzero(ablockMap, bmsize); + memset(ablockMap, 0, bmsize); ablockMap->nEntries = blockEntries[blocktype]; /* save the block header in the block map */ - bcopy(&block.h, &ablockMap->header, sizeof(ablockMap->header)); + memcpy(&ablockMap->header, &block.h, sizeof(ablockMap->header)); blockMap[i] = ablockMap; } @@ -1276,7 +1276,7 @@ verifyDatabase(ut, recreateFile) /* clear verification statistics */ misc = &miscData; - bzero (&miscData, sizeof(miscData)); + memset(&miscData, 0, sizeof(miscData)); #ifdef PDEBUG miscData.maxErrors = 1000000; @@ -1309,7 +1309,7 @@ verifyDatabase(ut, recreateFile) bmsize = nBlocks*sizeof(struct blockMap *); blockMap = (struct blockMap **) malloc(bmsize); if (!blockMap) ERROR(BUDB_NOMEM); - bzero(blockMap, bmsize); + memset(blockMap, 0, bmsize); /* verify blocks and construct the block map */ Log("Read header of every block\n"); @@ -1462,7 +1462,7 @@ error_exit: if (!th) *host = 0; else { - bcopy(th->h_addr, host, sizeof(afs_int32)); + memcpy(host, th->h_addr, sizeof(afs_int32)); *host = ntohl(*host); } diff --git a/src/budb/procs.c b/src/budb/procs.c index d6d414a..aa8f4fd 100644 --- a/src/budb/procs.c +++ b/src/budb/procs.c @@ -123,7 +123,7 @@ tailCompPtr(pathNamePtr) char *pathNamePtr; { char *ptr; - ptr = rindex(pathNamePtr, '/'); + ptr = strrchr(pathNamePtr, '/'); if ( ptr == 0 ) { /* this should never happen */ @@ -516,7 +516,7 @@ SendReturnList (ut, list, FillProc, e_size, index, nextIndexP, dbTimeP, eList) eList->budb_dumpList_val = (struct budb_dumpEntry *)malloc (e_size * to_return); if (!eList->budb_dumpList_val) return(BUDB_NOMEM); } - bzero(eList->budb_dumpList_val, e_size * to_return); + memset(eList->budb_dumpList_val, 0, e_size * to_return); eList->budb_dumpList_len = to_return; e = (char *)(eList->budb_dumpList_val); @@ -707,7 +707,7 @@ static afs_int32 GetVolInfo (ut, volP, viaP, viP) else if ( !VolInfoMatch(volP,viP) ) /* Not the head volinfo struct */ { hvia = via; /* remember the head volinfo struct */ - bcopy(viP, &hvi, sizeof(hvi)); + memcpy(&hvi, viP, sizeof(hvi)); /* Search the same name chain for the correct volinfo structure */ for (via=ntohl(viP->sameNameChain); via; via=ntohl(viP->sameNameChain)) @@ -998,7 +998,7 @@ rememberDump(dumpAddrParam, dumpParam, dumpListPtrParam) ptr = (struct chosenDump *) malloc(sizeof(*ptr)); if (!ptr) return(0); - bzero(ptr, sizeof(*ptr)); + memset(ptr, 0, sizeof(*ptr)); ptr->addr = dumpAddr; ptr->date = (afs_uint32) ntohl(dumpPtr->created); @@ -1385,7 +1385,7 @@ afs_int32 CreateDump(call, dump) } /* Allocate a dump structure */ - bzero (&d, sizeof(d)); + memset(&d, 0, sizeof(d)); eval = AllocStructure (ut, dump_BLOCK, 0, &da, &d); if (eval) ABORT(eval); @@ -2040,7 +2040,7 @@ afs_int32 FindLatestDump (call, vsname, dumpPath, dumpentry) /* Construct a database dump name */ strcpy(dumpName, DUMP_TAPE_NAME); } - else if (index(dumpPath,'/') == 0) { + else if (strchr(dumpPath,'/') == 0) { int level, old, length, hash; struct dump hostDump, diskDump; struct memoryHashTable *mht; @@ -2450,7 +2450,7 @@ afs_int32 GetDumps (call, majorVersion, flags, name, start, end, /* end specifies how many dumps */ if (!end) ABORT(BUDB_BADFLAGS); - bzero(&rock, sizeof(rock)); + memset(&rock, 0, sizeof(rock)); rock.maxDumps = end; scanHashTable(ut, &db.dumpName, wantDump, rememberDump, (char *) &rock); @@ -2737,7 +2737,7 @@ afs_int32 FindLastTape (call, dumpID, dumpEntry, tapeEntry, volEntry) /* Zero volume entry if the last tape has no volumes */ if (!lastVol) { - bzero(volEntry, sizeof(*volEntry)); + memset(volEntry, 0, sizeof(*volEntry)); } else { /* Follow the volumes until we reach the last volume */ eval = dbread (ut,lastVol,&vf,sizeof(vf)); @@ -3138,7 +3138,7 @@ afs_int32 UseTape (call, tape, new) *new = 0; - bzero (&t, sizeof(t)); + memset(&t, 0, sizeof(t)); eval = AllocStructure (ut, tape_BLOCK, 0, &a, &t); if (eval) ABORT(eval); diff --git a/src/budb/server.c b/src/budb/server.c index 2ba26d4..1ef804d 100644 --- a/src/budb/server.c +++ b/src/budb/server.c @@ -94,7 +94,7 @@ convert_cell_to_ubik (cellinfo, myHost, serverList) printf("prserver: couldn't get address of this host.\n"); BUDB_EXIT(1); } - bcopy(th->h_addr,myHost,sizeof(afs_int32)); + memcpy(myHost, th->h_addr, sizeof(afs_int32)); for (i=0; inumServers; i++) /* omit my host from serverList */ @@ -351,7 +351,7 @@ main(argc, argv) exit(2); } - bzero(globalConfPtr, sizeof(*globalConfPtr)); + memset(globalConfPtr, 0, sizeof(*globalConfPtr)); /* set default configuration values */ strcpy(dbDir, AFSDIR_SERVER_DB_DIRPATH); @@ -494,7 +494,7 @@ main(argc, argv) /* misc. initialization */ /* database dump synchronization */ - bzero(dumpSyncPtr, sizeof(*dumpSyncPtr)); + memset(dumpSyncPtr, 0, sizeof(*dumpSyncPtr)); Lock_Init(&dumpSyncPtr->ds_lock); rx_StartServer(0); /* start handling requests */ diff --git a/src/budb/struct_ops.c b/src/budb/struct_ops.c index 9f0187e..ca3b5b2 100644 --- a/src/budb/struct_ops.c +++ b/src/budb/struct_ops.c @@ -547,7 +547,7 @@ dumpToBudbDump(dumpPtr, budbDumpPtr) budbDumpPtr->created = dumpPtr->created; budbDumpPtr->nVolumes = dumpPtr->nVolumes; - bcopy(&dumpPtr->tapes, &budbDumpPtr->tapes, sizeof(struct budb_tapeSet)); + memcpy(&budbDumpPtr->tapes, &dumpPtr->tapes, sizeof(struct budb_tapeSet)); copy_ktcPrincipal_to_budbPrincipal(&dumpPtr->dumper, &budbDumpPtr->dumper); return(0); } @@ -611,7 +611,7 @@ default_tapeset(tapesetPtr, dumpname) struct budb_tapeSet *tapesetPtr; char *dumpname; { - bzero(tapesetPtr, sizeof(*tapesetPtr)); + memset(tapesetPtr, 0, sizeof(*tapesetPtr)); strcpy(tapesetPtr->format, dumpname); strcat(tapesetPtr->format, ".%d"); diff --git a/src/butc/dbentries.c b/src/butc/dbentries.c index 6185200..68c9bb6 100644 --- a/src/butc/dbentries.c +++ b/src/butc/dbentries.c @@ -75,7 +75,7 @@ afs_int32 threadEntryDir(anEntry, size, type) entryPtr->dlq_type = type; entryPtr->dlq_structPtr = entry; - bcopy (anEntry, entry, size); + memcpy(entry, anEntry, size); dlqLinkb (&entries_to_flush, entryPtr); return(0); } @@ -119,7 +119,7 @@ threadEntry(anEntry, size, type) entryPtr->dlq_type = type; entryPtr->dlq_structPtr = entry; - bcopy (anEntry, entry, size); + memcpy(entry, anEntry, size); dlqLinkb (&savedEntries, (dlqlinkP)entryPtr); return(0); } @@ -164,7 +164,7 @@ afs_int32 useTape (aTapeEntryPtr, dumpID, tapename, tapeSeq, useCount, written, { afs_int32 code = 0; - bzero(aTapeEntryPtr, sizeof(struct budb_tapeEntry)); + memset(aTapeEntryPtr, 0, sizeof(struct budb_tapeEntry)); strcpy(aTapeEntryPtr->name, tapename); aTapeEntryPtr->flags = BUDB_TAPE_BEINGWRITTEN; aTapeEntryPtr->written = written; /* When label was written */ @@ -221,7 +221,7 @@ afs_int32 addVolume(aVolEntryPtr, dumpID, tapename, volname, volid, cloneDate, allo = 1; } - bzero(aVolEntryPtr, sizeof(struct budb_volumeEntry)); + memset(aVolEntryPtr, 0, sizeof(struct budb_volumeEntry)); strcpy(aVolEntryPtr->name, volname); aVolEntryPtr->flags = flags; aVolEntryPtr->id = volid; @@ -417,7 +417,7 @@ dbWatcher() break; } - bcopy(volPtr, &volumes[c], sizeof(struct budb_volumeEntry)); + memcpy(&volumes[c], volPtr, sizeof(struct budb_volumeEntry)); free(volPtr); free(entryPtr); entryPtr = (dlqlinkP)0; diff --git a/src/butc/dump.c b/src/butc/dump.c index c3279d5..37019d2 100644 --- a/src/butc/dump.c +++ b/src/butc/dump.c @@ -106,7 +106,7 @@ localtime_r(t, tm) time_t *t; struct tm *tm; { - bcopy(localtime(t), tm, sizeof(struct tm)); + memcpy(tm, localtime(t), sizeof(struct tm)); } #endif @@ -910,7 +910,7 @@ dumpPass(dparamsPtr, passNumber) } /* Remember the server and partition the volume exists on */ - bzero (&server, sizeof(server)); + memset(&server, 0, sizeof(server)); server.sin_addr.s_addr = vldbEntry.serverNumber[e]; server.sin_port = 0; server.sin_family = AF_INET; @@ -1124,7 +1124,7 @@ Dumper(nodePtr) TapeLog(2, taskId, 0, 0, "Dump %s\n", nodePtr->dumpSetName); /* setup the dump parameters */ - bzero(&dparams, sizeof(dparams)); + memset(&dparams, 0, sizeof(dparams)); dparams.node = nodePtr; dparams.tapeInfoPtr = &tapeInfo; dlqInit(&savedEntries); @@ -1180,7 +1180,7 @@ Dumper(nodePtr) ErrorLog(0, taskId, code, 0, "Can't read backup database\n"); ERROR_EXIT(code); } - bzero(&dparams.lastDump, sizeof(dparams.lastDump)); + memset(&dparams.lastDump, 0, sizeof(dparams.lastDump)); } code = createDump(&dparams); /* enter dump into database */ @@ -1535,7 +1535,7 @@ getDumpTape(dparamsPtr, interactiveFlag, append) ErrorLog(0, taskId, code, tapeInfoPtr->error, "Warning: Tape error while reading label (will proceed with dump)\n"); } - bzero(&oldTapeLabel, sizeof(oldTapeLabel)); + memset(&oldTapeLabel, 0, sizeof(oldTapeLabel)); } /* Check if null tape. Prior 3.3, backup tapes have no dump id */ @@ -1689,8 +1689,8 @@ getDumpTape(dparamsPtr, interactiveFlag, append) */ for (dmp=oldTapeLabel.dumpid; dmp; dmp=de.appendedDumpID) { if (dmp == dparamsPtr->lastDump.id) { - bcopy(&dparamsPtr->lastDump, &de, sizeof(de)); - bcopy(&dparamsPtr->lastDump, &de2, sizeof(de2)); + memcpy(&de, &dparamsPtr->lastDump, sizeof(de)); + memcpy(&de2, &dparamsPtr->lastDump, sizeof(de2)); } else { code = bcdb_FindDumpByID(dmp, &de); @@ -1831,7 +1831,7 @@ makeVolumeHeader(vhptr, dparamsPtr, fragmentNumber) curDump = &nodePtr->dumps[dparamsPtr->curVolume]; - bzero(vhptr, sizeof(*vhptr)); + memset(vhptr, 0, sizeof(*vhptr)); strcpy(vhptr->volumeName, curDump->name); vhptr->volumeID = curDump->vid; vhptr->cloneDate = curDump->cloneDate; @@ -1876,7 +1876,7 @@ volumeHeader_hton(hostPtr, netPtr) volHdr.versionflags = htonl(hostPtr->versionflags); volHdr.cloneDate = htonl(hostPtr->cloneDate); - bcopy(&volHdr, netPtr, sizeof(struct volumeHeader)); + memcpy(netPtr, &volHdr, sizeof(struct volumeHeader)); } /* database related routines */ @@ -1890,7 +1890,7 @@ createDump(dparamsPtr) afs_int32 code = 0; dumpPtr = &dparamsPtr->dump; - bzero(dumpPtr, sizeof(*dumpPtr)); + memset(dumpPtr, 0, sizeof(*dumpPtr)); /* id filled in by database */ dumpPtr->parent = nodePtr->parent; diff --git a/src/butc/list.c b/src/butc/list.c index 0f5c994..7f97c27 100644 --- a/src/butc/list.c +++ b/src/butc/list.c @@ -74,7 +74,7 @@ struct dumpNode **newNode; /* get space */ *newNode = (struct dumpNode *) (malloc (sizeof (struct dumpNode))); - bzero(*newNode, sizeof(struct dumpNode)); + memset(*newNode, 0, sizeof(struct dumpNode)); (*newNode)->next = dumpQHeader->next; dumpQHeader->next = *newNode; diff --git a/src/butc/lwps.c b/src/butc/lwps.c index 62b0ec4..6cee5a0 100644 --- a/src/butc/lwps.c +++ b/src/butc/lwps.c @@ -102,7 +102,7 @@ struct restoreParams magic == TC_VOLENDMAGIC || \ magic == TC_VOLCONTD ) { \ \ - bcopy (&vhptr, header, sizeof(struct volumeHeader)); \ + memcpy(header, &vhptr, sizeof(struct volumeHeader)); \ return (0); \ } /* magic */ \ } /* versionflags */ \ @@ -838,7 +838,7 @@ VolHeaderToHost(hostVolHeader, tapeVolHeader) { case TAPE_VERSION_0: /* sizes in bytes and fields in host order */ - bcopy(hostVolHeader, tapeVolHeader, sizeof(struct volumeHeader)); + memcpy(tapeVolHeader, hostVolHeader, sizeof(struct volumeHeader)); break; case TAPE_VERSION_1: @@ -1110,7 +1110,7 @@ afs_int32 xbsaRestoreVolumeData(call, rparamsPtr) } /* fill tbuffer with end of buffer */ bytesRead -= sizeof(tbuffer); - bcopy(buffer+bytesRead, tbuffer, sizeof(tbuffer)); + memcpy(tbuffer, buffer+bytesRead, sizeof(tbuffer)); tbuffersize = sizeof(tbuffer); /* Write out whatever is left over in buffer */ if (bytesRead) { @@ -1125,7 +1125,7 @@ afs_int32 xbsaRestoreVolumeData(call, rparamsPtr) } else if ((tbuffersize + bytesRead) <= sizeof(tbuffer)) { /* Copy all of buffer into tbuffer (it will fit) */ - bcopy(buffer, tbuffer+tbuffersize, bytesRead); + memcpy(tbuffer+tbuffersize, buffer, bytesRead); tbuffersize += bytesRead; bytesRead = 0; } @@ -1141,10 +1141,10 @@ afs_int32 xbsaRestoreVolumeData(call, rparamsPtr) tbuffersize -= w; /* Move the data in tbuffer up */ - bcopy(tbuffer+towrite, tbuffer, tbuffersize); + memcpy(tbuffer, tbuffer+towrite, tbuffersize); /* Now copy buffer in */ - bcopy(buffer, tbuffer+tbuffersize, bytesRead); + memcpy(tbuffer+tbuffersize, buffer, bytesRead); tbuffersize += bytesRead; bytesRead = 0; } @@ -1681,7 +1681,7 @@ Restorer (newNode) printf("\n\n"); TLog (taskId, "Restore\n"); - bzero(&tapeInfo, sizeof(tapeInfo)); + memset(&tapeInfo, 0, sizeof(tapeInfo)); if (!CONF_XBSA) { tapeInfo.structVersion = BUTM_MAJORVERSION; tcode = butm_file_Instantiate (&tapeInfo, &globalTapeConfig); @@ -1694,7 +1694,7 @@ Restorer (newNode) if ( checkAbortByTaskId(taskId) ) ERROR_EXIT(TC_ABORTEDBYREQUEST); - bzero(&rparams, sizeof(rparams)); + memset(&rparams, 0, sizeof(rparams)); rparams.nodePtr = newNode; rparams.tapeInfoPtr = &tapeInfo; Restore = newNode->restores; /* Array of vol fragments to restore */ @@ -1711,7 +1711,7 @@ Restorer (newNode) bufferBlock = (struct TapeBlock *)0; bufferBlock = (struct TapeBlock *) malloc(allocbufferSize); if (!bufferBlock) ERROR_EXIT(TC_NOMEMORY); - bzero(bufferBlock, allocbufferSize); + memset(bufferBlock, 0, allocbufferSize); startTime = time(0); for (rparams.frag=0; (rparams.frag < newNode->arraySize); rparams.frag++) { @@ -1846,7 +1846,7 @@ GetNewLabel(tapeInfoPtr, pName, AFSName, tapeLabel) struct timezone tzp; afs_uint32 size; - bzero(tapeLabel,sizeof(struct butm_tapeLabel)); + memset(tapeLabel, 0, sizeof(struct butm_tapeLabel)); if (!CONF_XBSA) { butm_GetSize(tapeInfoPtr, &size); @@ -1955,9 +1955,9 @@ FindVolTrailer2(buffera, sizea, dataSizea, bufferb, sizeb, dataSizeb, volTrailer if (!s) return 0; } - bzero(tapeVolumeHT, sizeof(tapeVolumeHT)); - if (headB) bcopy (buffera + sizea - headB, tapeVolumeHT , headB); - if (tailB) bcopy (bufferb , tapeVolumeHT + headB, tailB); + memset(tapeVolumeHT, 0, sizeof(tapeVolumeHT)); + if (headB) memcpy(tapeVolumeHT , buffera + sizea - headB, headB); + if (tailB) memcpy(tapeVolumeHT + headB, bufferb , tailB); if (ExtractTrailer (tapeVolumeHT, s, &offset, volTrailerPtr)) { found = 1; if (offset > headB) { @@ -2152,7 +2152,7 @@ Labeller (labelIfPtr) printf("\n\n"); TLog (taskId, "Labeltape\n"); - bzero(&tapeInfo, sizeof(tapeInfo)); + memset(&tapeInfo, 0, sizeof(tapeInfo)); tapeInfo.structVersion = BUTM_MAJORVERSION; code = butm_file_Instantiate (&tapeInfo, &globalTapeConfig); if (code) @@ -2245,7 +2245,7 @@ struct tc_tapeLabel *label; printf("\n\n"); TLog (taskId, "Readlabel\n"); - bzero(&tapeInfo,sizeof(tapeInfo)); + memset(&tapeInfo, 0, sizeof(tapeInfo)); tapeInfo.structVersion = BUTM_MAJORVERSION; code = butm_file_Instantiate (&tapeInfo, &globalTapeConfig); if (code) @@ -2253,7 +2253,7 @@ struct tc_tapeLabel *label; ErrorLog(0, taskId, code, tapeInfo.error, "Can't initialize the tape module\n"); ERROR_EXIT(code); } - bzero(&newTapeLabel,sizeof(newTapeLabel)); + memset(&newTapeLabel, 0, sizeof(newTapeLabel)); interactiveFlag = autoQuery; @@ -2354,20 +2354,20 @@ readVolumeHeader (buffer, bufloc, header) (strncmp(tempvhptr->postamble, "T--NAME#",8) == 0) ) { /* Handle Cases 2 & 3 */ - bcopy (buffer+bufloc, &vhptr, sizeof(struct volumeHeader)); + memcpy(&vhptr, buffer+bufloc, sizeof(struct volumeHeader)); HEADER_CHECKS(vhptr, header); /* Handle Case 4 */ - bzero (&vhptr, sizeof(struct volumeHeader)); - bcopy (buffer+bufloc, &vhptr, firstSplice); - bzero (&vhptr.pad, padLen); - bcopy (buffer+bufloc+firstSplice, &vhptr.volumeID, nextSplice); + memset(&vhptr, 0, sizeof(struct volumeHeader)); + memcpy(&vhptr, buffer+bufloc, firstSplice); + memset(&vhptr.pad, 0, padLen); + memcpy(&vhptr.volumeID, buffer+bufloc+firstSplice, nextSplice); HEADER_CHECKS(vhptr, header); /* Handle Case 1 */ - bzero (&vhptr, sizeof(struct volumeHeader)); - bcopy (buffer+bufloc, &vhptr, firstSplice); - bcopy (buffer+bufloc+firstSplice+padLen, &vhptr+firstSplice, nextSplice); + memset(&vhptr, 0, sizeof(struct volumeHeader)); + memcpy(&vhptr, buffer+bufloc, firstSplice); + memcpy(&vhptr+firstSplice, buffer+bufloc+firstSplice+padLen, nextSplice); HEADER_CHECKS(vhptr, header); } diff --git a/src/butc/recoverDb.c b/src/butc/recoverDb.c index 8f41716..bf99054 100644 --- a/src/butc/recoverDb.c +++ b/src/butc/recoverDb.c @@ -139,7 +139,7 @@ readDumps(taskId, tapeInfoPtr, scanInfoPtr) { afs_int32 code, c; - bcopy(&scanInfoPtr->tapeLabel, &scanInfoPtr->dumpLabel, sizeof(struct butm_tapeLabel)); + memcpy(&scanInfoPtr->dumpLabel, &scanInfoPtr->tapeLabel, sizeof(struct butm_tapeLabel)); while(1) { @@ -280,10 +280,10 @@ ScanDumps(ptr) if (ptr->addDbFlag) TLog(taskId, "ScanTape and add to the database\n"); else TLog(taskId, "Scantape\n"); - bzero(&tapeScanInfo, sizeof(tapeScanInfo)); + memset(&tapeScanInfo, 0, sizeof(tapeScanInfo)); tapeScanInfo.addDbFlag = ptr->addDbFlag; - bzero(&curTapeInfo, sizeof(curTapeInfo)); + memset(&curTapeInfo, 0, sizeof(curTapeInfo)); curTapeInfo.structVersion = BUTM_MAJORVERSION; code = butm_file_Instantiate (&curTapeInfo, &globalTapeConfig); if (code) @@ -359,7 +359,7 @@ scanVolData(taskId, curTapePtr, tapeVersion, volumeHeader, volumeTrailer, bytesR afs_int32 code = 0; afs_int32 rcode, tcode; - bzero(volumeHeader, sizeof(struct volumeHeader)); + memset(volumeHeader, 0, sizeof(struct volumeHeader)); block = (char *) malloc(2*BUTM_BLOCKSIZE); if (!block) return(TC_NOMEMORY); @@ -488,7 +488,7 @@ nextTapeLabel(prevTapeName) /* extract information from previous tape label */ strcpy(buffer, prevTapeName); - prevdot = rindex(buffer, '.'); + prevdot = strrchr(buffer, '.'); if (!prevdot) return(retval); prevdot++; @@ -800,11 +800,11 @@ validatePath(labelptr, pathptr) strcpy(tapeName, labelptr->AFSName); - tp = rindex(tapeName, '.'); + tp = strrchr(tapeName, '.'); if ( !tp ) return(1); tp++; - up = rindex(pathptr, '/'); + up = strrchr(pathptr, '/'); if ( !up ) { fprintf(stderr, "Invalid path name, missing /\n"); @@ -839,7 +839,7 @@ volumesetNamePtr(ptr) char *dotPtr; int dotIndex; - dotPtr = index(ptr, '.'); + dotPtr = strchr(ptr, '.'); if ( !dotPtr ) return(0); dotIndex = dotPtr - ptr; @@ -859,7 +859,7 @@ extractDumpName(ptr) char *dotPtr; int dotIndex; - dotPtr = rindex(ptr, '.'); + dotPtr = strrchr(ptr, '.'); if (!dotPtr) return(0); dotIndex = dotPtr - ptr; @@ -887,7 +887,7 @@ extractTapeSeq(tapename) { char *sptr; - sptr = rindex(tapename, '.'); + sptr = strrchr(tapename, '.'); if ( !sptr ) return(-1); sptr++; return(atol(sptr)); @@ -903,7 +903,7 @@ int databaseTape(tapeName) char *sptr; int c; - sptr = rindex(tapeName, '.'); + sptr = strrchr(tapeName, '.'); if ( !sptr ) return(0); c = (int)( (afs_int32)sptr - (afs_int32)tapeName ); @@ -922,7 +922,7 @@ afs_int32 RcreateDump(tapeScanInfoPtr, volHeaderPtr) struct budb_dumpEntry *dumpEntryPtr = &tapeScanInfoPtr->dumpEntry; /* construct dump entry */ - bzero(dumpEntryPtr, sizeof(struct budb_dumpEntry)); + memset(dumpEntryPtr, 0, sizeof(struct budb_dumpEntry)); dumpEntryPtr->id = volHeaderPtr->dumpID; dumpEntryPtr->initialDumpID = tapeScanInfoPtr->initialDumpId; dumpEntryPtr->parent = volHeaderPtr->parentID; diff --git a/src/butc/tcmain.c b/src/butc/tcmain.c index 33b8d50..d50d0d9 100644 --- a/src/butc/tcmain.c +++ b/src/butc/tcmain.c @@ -1165,7 +1165,7 @@ char **argv; */ if (argc == 1) { ts = (struct cmd_syndesc *) malloc(sizeof(struct cmd_syndesc)); - bzero(ts, sizeof(*ts)); + memset(ts, 0, sizeof(*ts)); ti = (struct cmd_item *) malloc(sizeof(struct cmd_item)); ti->next = 0; diff --git a/src/butc/tcprocs.c b/src/butc/tcprocs.c index 21d71d0..827a827 100644 --- a/src/butc/tcprocs.c +++ b/src/butc/tcprocs.c @@ -99,7 +99,7 @@ STC_LabelTape(acid, label, taskId) ptr = (struct labelTapeIf *) malloc(sizeof(*ptr)); if (!ptr) ERROR_EXIT(TC_NOMEMORY); - bcopy(label, &ptr->label, sizeof(ptr->label)); + memcpy(&ptr->label, label, sizeof(ptr->label)); /* set up the status node */ *taskId = allocTaskId(); /* for bucoord */ diff --git a/src/butc/tcudbprocs.c b/src/butc/tcudbprocs.c index 68bec74..506e1b7 100644 --- a/src/butc/tcudbprocs.c +++ b/src/butc/tcudbprocs.c @@ -58,7 +58,7 @@ afs_int32 CreateDBDump(dumpEntryPtr) { afs_int32 code = 0; - bzero(dumpEntryPtr, sizeof(struct budb_dumpEntry)); + memset(dumpEntryPtr, 0, sizeof(struct budb_dumpEntry)); strcpy(dumpEntryPtr->name, DUMP_TAPE_NAME); strcpy(dumpEntryPtr->tapes.format, DUMP_TAPE_NAME); @@ -140,7 +140,7 @@ afs_int32 GetDBTape(taskId, expires, tapeInfoPtr, dumpid, sequence, queryFlag, w goto getNewTape; } - bzero(&oldTapeLabel, sizeof(oldTapeLabel)); + memset(&oldTapeLabel, 0, sizeof(oldTapeLabel)); code = butm_ReadLabel(tapeInfoPtr, &oldTapeLabel, 1); /* rewind tape */ if (code) { @@ -192,8 +192,8 @@ afs_int32 GetDBTape(taskId, expires, tapeInfoPtr, dumpid, sequence, queryFlag, w */ for (dmp=oldTapeLabel.dumpid; dmp; dmp=de.appendedDumpID) { if (dmp == lastDump.id) { - bcopy(&lastDump, &de, sizeof(de)); - bcopy(&lastDump, &de2, sizeof(de2)); + memcpy(&de, &lastDump, sizeof(de)); + memcpy(&de2, &lastDump, sizeof(de2)); } else { code = bcdb_FindDumpByID(dmp, &de); @@ -259,7 +259,7 @@ afs_int32 GetDBTape(taskId, expires, tapeInfoPtr, dumpid, sequence, queryFlag, w /* Initialize a tapeEntry for later inclusion into the database*/ listEntryPtr = (struct tapeEntryList *)malloc(sizeof(struct tapeEntryList)); if (!listEntryPtr) ERROR_EXIT(TC_NOMEMORY); - bzero(listEntryPtr, sizeof(struct tapeEntryList)); + memset(listEntryPtr, 0, sizeof(struct tapeEntryList)); /* Remember dumpid so we can delete it later */ if ( (oldTapeLabel.structVersion >= TAPE_VERSION_3) && oldTapeLabel.dumpid ) @@ -404,14 +404,14 @@ saveDbToTape(saveDbIfPtr) } /* Determine what the last database dump was */ - bzero(&lastDump, sizeof(lastDump)); + memset(&lastDump, 0, sizeof(lastDump)); code = bcdb_FindLatestDump("", "", &lastDump); if (code) { if (code != BUDB_NODUMPNAME) { ErrorLog(0, taskId, code, 0, "Can't read backup database\n"); ERROR_EXIT(code); } - bzero(&lastDump, sizeof(lastDump)); + memset(&lastDump, 0, sizeof(lastDump)); } code = CreateDBDump(&dumpEntry); /* Create a dump for this tape */ @@ -513,7 +513,7 @@ afs_int32 makeDbDumpEntry(tapeEntPtr, dumpEntryPtr) { afs_int32 code; - bzero(dumpEntryPtr, sizeof(struct budb_dumpEntry)); + memset(dumpEntryPtr, 0, sizeof(struct budb_dumpEntry)); dumpEntryPtr->id = tapeEntPtr->dump; dumpEntryPtr->initialDumpID = 0; @@ -627,7 +627,7 @@ afs_int32 readDbTape(tapeInfoPtr, rstTapeInfoPtr, query) /* Initialize a tapeEntry for later inclusion into the database*/ listEntryPtr = (struct tapeEntryList *) malloc(sizeof(struct tapeEntryList)); if (!listEntryPtr) ERROR_EXIT(TC_NOMEMORY); - bzero(listEntryPtr, sizeof(struct tapeEntryList)); + memset(listEntryPtr, 0, sizeof(struct tapeEntryList)); /* Fill in tape entry so we can save it later */ strcpy(tapeEntryPtr->name, TNAME(&oldTapeLabel)); @@ -840,7 +840,7 @@ writeDbDump(tapeInfoPtr, taskId, expires, dumpid) if (!writeBlock) ERROR_EXIT(TC_NOMEMORY); writeBuffer = writeBlock + sizeof(struct blockMark); - bzero(writeBuffer, BUTM_BLKSIZE); + memset(writeBuffer, 0, BUTM_BLKSIZE); maxReadSize = 1024; /* @@ -927,7 +927,7 @@ writeDbDump(tapeInfoPtr, taskId, expires, dumpid) transferSize = (charList.charListT_len < (blockSize - writeBufNbytes)) ? charList.charListT_len : (blockSize - writeBufNbytes); - bcopy(readBufPtr, writeBufPtr, transferSize); + memcpy(writeBufPtr, readBufPtr, transferSize); charList.charListT_len -= transferSize; writeBufPtr += transferSize; readBufPtr += transferSize; @@ -943,7 +943,7 @@ writeDbDump(tapeInfoPtr, taskId, expires, dumpid) ERROR_EXIT(code); } - bzero(writeBuffer, blockSize); + memset(writeBuffer, 0, blockSize); writeBufPtr = &writeBuffer[0]; writeBufNbytes = 0; @@ -1061,7 +1061,7 @@ restoreDbEntries(tapeInfoPtr, rstTapeInfoPtr) } /* get the first item-header */ - bzero(&netItemHeader, sizeof(netItemHeader)); + memset(&netItemHeader, 0, sizeof(netItemHeader)); code = getTapeData(tapeInfoPtr, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, &hostItemHeader); @@ -1138,7 +1138,7 @@ restoreDbHeader(tapeInfo, rstTapeInfoPtr, nextHeader) extern struct udbHandleS udbHandle; /* Read the database header */ - bzero(&netDbHeader, sizeof(netDbHeader)); + memset(&netDbHeader, 0, sizeof(netDbHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netDbHeader, sizeof(netDbHeader)); if (code) ERROR_EXIT(code); DbHeader_ntoh(&netDbHeader, &hostDbHeader); @@ -1152,7 +1152,7 @@ restoreDbHeader(tapeInfo, rstTapeInfoPtr, nextHeader) } /* get the next item-header */ - bzero(nextHeader, sizeof(*nextHeader)); + memset(nextHeader, 0, sizeof(*nextHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, nextHeader); @@ -1192,7 +1192,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) taskId = rstTapeInfoPtr->taskId; /* read dump entry */ - bzero(&netDumpEntry, sizeof(netDumpEntry)); + memset(&netDumpEntry, 0, sizeof(netDumpEntry)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netDumpEntry, sizeof(netDumpEntry)); if (code) ERROR_EXIT(code); @@ -1216,7 +1216,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) } /* get the next item-header */ - bzero(nextHeader, sizeof(*nextHeader)); + memset(nextHeader, 0, sizeof(*nextHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, nextHeader); @@ -1226,7 +1226,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) { /*t*/ /* read the tape entry */ - bzero(&netTapeEntry, sizeof(netTapeEntry)); + memset(&netTapeEntry, 0, sizeof(netTapeEntry)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netTapeEntry, sizeof(netTapeEntry)); if (code) ERROR_EXIT(code); tapeEntry_ntoh(&netTapeEntry, &hostTapeEntry); @@ -1238,7 +1238,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) } /* get the next item-header */ - bzero(nextHeader, sizeof(*nextHeader)); + memset(nextHeader, 0, sizeof(*nextHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, nextHeader); @@ -1248,7 +1248,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) { /*v*/ /* read the volume entry */ - bzero(&netVolumeEntry, sizeof(netVolumeEntry)); + memset(&netVolumeEntry, 0, sizeof(netVolumeEntry)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netVolumeEntry, sizeof(netVolumeEntry)); if (code) ERROR_EXIT(code); volumeEntry_ntoh(&netVolumeEntry, &hostVolumeEntry); @@ -1259,7 +1259,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) } /* get the next item-header */ - bzero(nextHeader, sizeof(*nextHeader)); + memset(nextHeader, 0, sizeof(*nextHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, nextHeader); @@ -1301,7 +1301,7 @@ saveTextFile(taskId, textType, fileName) ctPtr = (udbClientTextP) malloc(sizeof(*ctPtr)); if (!ctPtr) ERROR_EXIT(TC_NOMEMORY); - bzero(ctPtr, sizeof(*ctPtr)); + memset(ctPtr, 0, sizeof(*ctPtr)); ctPtr->textType = textType; /* lock the text in the database */ @@ -1435,7 +1435,7 @@ restoreText(tapeInfo, rstTapeInfoPtr, nextHeader) unlink(filename); /* get the next item-header */ - bzero(nextHeader, sizeof(*nextHeader)); + memset(nextHeader, 0, sizeof(*nextHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, nextHeader); @@ -1541,7 +1541,7 @@ getTapeData(tapeInfoPtr, rstTapeInfoPtr, buffer, requestedBytes) /* copy out data */ transferBytes = (nbytes < requestedBytes ) ? nbytes : requestedBytes; - bcopy(tapeReadBufferPtr, buffer, transferBytes); + memcpy(buffer, tapeReadBufferPtr, transferBytes); tapeReadBufferPtr += transferBytes; buffer += transferBytes; nbytes -= transferBytes; diff --git a/src/butc/tdump.c b/src/butc/tdump.c index b7d90a1..d68146e 100644 --- a/src/butc/tdump.c +++ b/src/butc/tdump.c @@ -19,7 +19,7 @@ afs_int32 glong(cp, index) int index; char *cp; { afs_int32 temp; - bcopy(cp+index*4, &temp, sizeof(afs_int32)); + memcpy(&temp, cp+index*4, sizeof(afs_int32)); return temp; } diff --git a/src/butc/test.c b/src/butc/test.c index 35253ae..49c8a9c 100644 --- a/src/butc/test.c +++ b/src/butc/test.c @@ -73,7 +73,7 @@ char *aname; { } th = gethostbyname(aname); if (!th) return 0; - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); return addr; } diff --git a/src/butm/butm_test.c b/src/butm/butm_test.c index b68592c..2b971c8 100644 --- a/src/butm/butm_test.c +++ b/src/butm/butm_test.c @@ -182,7 +182,7 @@ goto start; code = tapeInfo.ops.mount(&tapeInfo, "TAPE_NAME"); PASSq ("Mount tape", 0); - bzero(tapeLabelWrite, sizeof(tapeLabelWrite)); + memset(tapeLabelWrite, 0, sizeof(tapeLabelWrite)); tapeLabelWrite.structVersion = CUR_TAPE_VERSION; tapeLabelWrite.creationTime = time(0); tapeLabelWrite.expirationDate = time(0); @@ -201,7 +201,7 @@ goto start; code = tapeInfo.ops.readLabel(&tapeInfo, &tapeLabelRead, REWIND); PASS ("Read a label", 0); - if ( bcmp(&tapeLabelWrite, &tapeLabelRead, sizeof(tapeLabelWrite)) ) + if ( memcmp(&tapeLabelWrite, &tapeLabelRead, sizeof(tapeLabelWrite)) ) printf("FAILURE: Label Read is not same as label Written\n"); else printf("PASSED: Label Read is same as label Written\n"); diff --git a/src/butm/file_tm.c b/src/butm/file_tm.c index 0b77fca..07246ee 100644 --- a/src/butm/file_tm.c +++ b/src/butm/file_tm.c @@ -808,7 +808,7 @@ WriteTapeBlock(info, buffer, length, blockType) { if (length == 0) ERROR_EXIT(0); bmark = (struct blockMark *)buffer; - bzero(bmark, sizeof(struct blockMark)); + memset(bmark, 0, sizeof(struct blockMark)); bmark->magic = htonl(BLOCK_MAGIC); bmark->count = htonl(length); } @@ -899,7 +899,7 @@ ReadTapeBlock(info, buffer, blockType) p = (struct progress *)info->tmRock; - bzero(buffer, BUTM_BLOCKSIZE); + memset(buffer, 0, BUTM_BLOCKSIZE); label = (struct tapeLabel *)buffer; fmark = (struct fileMark *)buffer; bmark = (struct blockMark *)buffer; @@ -1209,12 +1209,12 @@ static afs_int32 file_WriteLabel (info, label, rewind) /* Copy the label into the tape block * ---------------------------------- */ - bzero(tapeBlock, BUTM_BLOCKSIZE); + memset(tapeBlock, 0, BUTM_BLOCKSIZE); if (!label->creationTime) label->creationTime = time(0); tlabel = (struct tapeLabel *)tapeBlock; - bcopy(label, &tlabel->label, sizeof(struct butm_tapeLabel)); + memcpy(&tlabel->label, label, sizeof(struct butm_tapeLabel)); tlabel->label.structVersion = htonl(CUR_TAPE_VERSION); tlabel->label.creationTime = htonl(tlabel->label.creationTime); tlabel->label.expirationDate = htonl(tlabel->label.expirationDate); @@ -1312,7 +1312,7 @@ file_ReadLabel (info, label, rewind) if (label) { tlabel = (struct tapeLabel *) tapeBlock; - bcopy(&tlabel->label, label, sizeof(struct butm_tapeLabel)); + memcpy(label, &tlabel->label, sizeof(struct butm_tapeLabel)); label->structVersion = ntohl(label->structVersion); label->creationTime = ntohl(label->creationTime); label->expirationDate = ntohl(label->expirationDate); @@ -1413,7 +1413,7 @@ file_WriteFileData (info, data, blocks, len) if (len < BUTM_BLKSIZE) { - bzero(&dstart[len], BUTM_BLKSIZE - len); + memset(&dstart[len], 0, BUTM_BLKSIZE - len); length = len; } else @@ -1430,7 +1430,7 @@ file_WriteFileData (info, data, blocks, len) if (b < (blocks-1)) b++; else if (len) - bcopy(&dstart[BUTM_BLKSIZE], &dstart[0], len); + memcpy(&dstart[0], &dstart[BUTM_BLKSIZE], len); } error_exit: @@ -1745,7 +1745,7 @@ afs_int32 butm_file_Instantiate (info, file) if (!info) ERROR_EXIT(BUTM_BADARGUMENT); if (info->structVersion != BUTM_MAJORVERSION) ERROR_EXIT(BUTM_OLDINTERFACE); - bzero (info, sizeof(struct butm_tapeInfo)); + memset(info, 0, sizeof(struct butm_tapeInfo)); info->structVersion = BUTM_MAJORVERSION; info->ops.mount = file_Mount; info->ops.dismount = file_Dismount; diff --git a/src/butm/test_ftm.c b/src/butm/test_ftm.c index 5807079..59b9ffc 100644 --- a/src/butm/test_ftm.c +++ b/src/butm/test_ftm.c @@ -220,7 +220,7 @@ int PerformDumpTest(TestInfo *tip) ERROR_EXIT (2); } - bzero(&label, sizeof(label)); + memset(&label, 0, sizeof(label)); gettimeofday(&tp, 0); label.structVersion = CUR_TAPE_VERSION; label.creationTime = tp.tv_sec; @@ -355,14 +355,14 @@ int PerformDumpTest(TestInfo *tip) tprogress = tlen = fprogress = flen = 0; while (1) { - bzero(tbuffer,BUTM_BLKSIZE); + memset(tbuffer, 0, BUTM_BLKSIZE); code = butm_ReadFileData (&info, tbuffer, BUTM_BLKSIZE, &tlen); if (code && code != BUTM_STATUS_EOF) { com_err (whoami, code, "Reading %dth tape data", i+1); ERROR_EXIT(6); } - bzero(fbuffer,BUTM_BLKSIZE); + memset(fbuffer, 0, BUTM_BLKSIZE); flen = read (fid, fbuffer, sizeof(fbuffer)); if (flen < 0) { com_err (whoami, errno, "Reading %dth file data", i+1); diff --git a/src/config/param.i386_nt40.h b/src/config/param.i386_nt40.h index 387ef4e..72a926f 100644 --- a/src/config/param.i386_nt40.h +++ b/src/config/param.i386_nt40.h @@ -34,14 +34,16 @@ typedef int ssize_t; /* these macros define Unix-style functions missing in VC++5.0/NT4.0 */ #define MAXPATHLEN _MAX_PATH -#define bzero(A, S) memset((void*)(A), 0, (size_t)(S)) -#define bcopy(A, B, S) memcpy((void*)(B), (void*)(A), (size_t)(S)) +#if 0 +#define memset(A, 0, S) memset((void*)(A), 0, (size_t)(S)) +#define memcpy(B, A, S) memcpy((void*)(B), (void*)(A), (size_t)(S)) /* There is a minor syntactic difference between memcmp and bcmp... */ -#define bcmp(A,B,S) (memcmp((void*)(A), (void*)(B), (size_t)(S)) ? 1 : 0) +#define memcmp(A, B, S) (memcmp((void*)(A), (void*)(B), (size_t)(S)) ? 1 : 0) +#define strchr(s, c) strchr(s, c) +#define strrchr(s, c) strrchr(s, c) +#endif #define strcasecmp(s1,s2) _stricmp(s1,s2) #define strncasecmp(s1,s2,n) _strnicmp(s1,s2,n) -#define index(s, c) strchr(s, c) -#define rindex(s, c) strrchr(s, c) #define sleep(seconds) Sleep((seconds) * 1000) #define fsync(fileno) _commit(fileno) #define ftruncate(fd, size) _chsize((fd), (long)(size)) diff --git a/src/config/param.i386_win95.h b/src/config/param.i386_win95.h index 2e63691..355714b 100644 --- a/src/config/param.i386_win95.h +++ b/src/config/param.i386_win95.h @@ -35,14 +35,16 @@ typedef int ssize_t; /* these macros define Unix-style functions missing in VC++5.0/NT4.0 */ #define MAXPATHLEN _MAX_PATH -#define bzero(A, S) memset((void*)(A), 0, (size_t)(S)) -#define bcopy(A, B, S) memcpy((void*)(B), (void*)(A), (size_t)(S)) +#if 0 +#define memset(A, 0, S) memset((void*)(A), 0, (size_t)(S)) +#define memcpy(B, A, S) memcpy((void*)(B), (void*)(A), (size_t)(S)) /* There is a minor syntactic difference between memcmp and bcmp... */ -#define bcmp(A,B,S) (memcmp((void*)(A), (void*)(B), (size_t)(S)) ? 1 : 0) +#define memcmp(A, B, S) (memcmp((void*)(A), (void*)(B), (size_t)(S)) ? 1 : 0) +#define strchr(s, c) strchr(s, c) +#define strrchr(s, c) strrchr(s, c) +#endif #define strcasecmp(s1,s2) _stricmp(s1,s2) #define strncasecmp(s1,s2,n) _strnicmp(s1,s2,n) -#define index(s, c) strchr(s, c) -#define rindex(s, c) strrchr(s, c) #define sleep(seconds) Sleep((seconds) * 1000) #define fsync(fileno) _commit(fileno) #define ftruncate(fd, size) _chsize((fd), (long)(size)) diff --git a/src/config/stds.h b/src/config/stds.h index 10e184a..b55170e 100644 --- a/src/config/stds.h +++ b/src/config/stds.h @@ -189,7 +189,9 @@ typedef struct afs_hyper_t { /* unsigned 64 bit integers */ #if defined(AFS_LINUX20_ENV) && defined(KERNEL) /* This is here instead of osi_machdep.h so fcrypt.c can pick it up. */ #include "../h/string.h" -#define bcopy(F,T,C) memcpy((T), (F), (C)) +#if 0 +#define bcopy(F, T, C) memcpy((T), (F), (C)) +#endif #endif diff --git a/src/dauth/dlog.c b/src/dauth/dlog.c index 05a658a..7354d44 100644 --- a/src/dauth/dlog.c +++ b/src/dauth/dlog.c @@ -108,7 +108,7 @@ static char *getpipepass() { static char gpbuf[MAX_PASSWD_LEN]; register int i, tc; - bzero(gpbuf, sizeof(gpbuf)); + memset(gpbuf, 0, sizeof(gpbuf)); for(i=0; i<(sizeof(gpbuf)-1); i++) { tc = fgetc(stdin); if (tc == '\n' || tc == EOF) break; @@ -156,14 +156,14 @@ int store_afs_token(unix_id, realm_p, tkt_type, ticket_p, ticket_len, token.startTime = starttime; token.endTime = endtime; - bcopy(session_key, (char *) &token.sessionKey, sizeof(token.sessionKey)); + memcpy((char *) &token.sessionKey, session_key, sizeof(token.sessionKey)); token.kvno = tkt_type; token.ticketLen = ticket_len; if (ticket_len > MAXKTCTICKETLEN) { fprintf(stderr, "dlog: DCE ticket is too long (length %d). Maximum length accepted by AFS cache manager is %d\n", MAXKTCTICKETLEN); exit(1); } - bcopy((char *) ticket_p, (char *) token.ticket, ticket_len); + memcpy((char *) token.ticket, (char *) ticket_p, ticket_len); sprintf(client.name, "AFS ID %d", unix_id); strcpy(client.instance, ""); @@ -186,7 +186,7 @@ char *make_string(s_p, length) fprintf(stderr, "dlog: out of memory\n"); exit(1); } - bcopy(s_p, new_p, length); + memcpy(new_p, s_p, length); new_p[length] = '\0'; return new_p; } @@ -316,7 +316,7 @@ int decode_reply(buf, buflen, reply_p) case ASN_OCTET_STRING: if (context == 1 && len == sizeof(reply_p->session_key)) { saw_session_key++; - bcopy(buf, reply_p->session_key, len); + memcpy(reply_p->session_key, buf, len); } buf += len; break; @@ -467,7 +467,7 @@ CommandProc (as, arock) * Discard command line arguments, in case the password is on the * command line (to avoid it showing up from a ps command). */ - for (i=1; iparms[aPASSWORD].items->data, sizeof(passwd) - 1); passwd[sizeof(passwd) - 1] = '\0'; - bzero (as->parms[aPASSWORD].items->data, - strlen(as->parms[aPASSWORD].items->data)); + memset(as->parms[aPASSWORD].items->data, 0, strlen(as->parms[aPASSWORD].items->data)); } if (as->parms[aLIFETIME].items) { @@ -704,7 +703,7 @@ bad_lifetime: } strcat(passwd, reply_p->salt); des_string_to_key(passwd, passwd_key); - bzero(passwd, strlen(passwd)); + memset(passwd, 0, strlen(passwd)); /* * Decrypt the private data returned by the DCE KDC, and forwarded @@ -724,8 +723,8 @@ bad_lifetime: /* * Destroy the key block: it's no longer needed. */ - bzero(schedule, sizeof(schedule)); - bzero(passwd_key, sizeof(passwd_key)); + memset(schedule, 0, sizeof(schedule)); + memset(passwd_key, 0, sizeof(passwd_key)); /* * Do a very quick and dirty ASN.1 decode of the relevant parts diff --git a/src/des/cbc_encrypt.c b/src/des/cbc_encrypt.c index 6fefc52..db79c88 100644 --- a/src/des/cbc_encrypt.c +++ b/src/des/cbc_encrypt.c @@ -73,8 +73,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) if (encrypt) { #ifdef MUSTALIGN if ((afs_int32) ivec & 3) { - bcopy((char *)ivec++, (char *)&t_output[0], sizeof(t_output[0])); - bcopy((char *)ivec, (char *)&t_output[1], sizeof(t_output[1])); + memcpy((char *)&t_output[0], (char *)ivec++, sizeof(t_output[0])); + memcpy((char *)&t_output[1], (char *)ivec, sizeof(t_output[1])); } else #endif @@ -87,8 +87,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) /* get input */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input++,(char *)&t_input[0],sizeof(t_input[0])); - bcopy((char *)input++,(char *)&t_input[1],sizeof(t_input[1])); + memcpy((char *)&t_input[0], (char *)input++, sizeof(t_input[0])); + memcpy((char *)&t_input[1], (char *)input++, sizeof(t_input[1])); } else #endif @@ -114,10 +114,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) /* copy temp output and save it for cbc */ #ifdef MUSTALIGN if ((afs_int32) output & 3) { - bcopy((char *)&t_output[0],(char *)output++, - sizeof(t_output[0])); - bcopy((char *)&t_output[1],(char *)output++, - sizeof(t_output[1])); + memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); + memcpy((char *)output++, (char *)&t_output[1], sizeof(t_output[1])); } else #endif @@ -140,8 +138,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) /* decrypt */ #ifdef MUSTALIGN if ((afs_int32) ivec & 3) { - bcopy((char *)ivec++,(char *)&xor_0,sizeof(xor_0)); - bcopy((char *)ivec,(char *)&xor_1,sizeof(xor_1)); + memcpy((char *)&xor_0, (char *)ivec++, sizeof(xor_0)); + memcpy((char *)&xor_1, (char *)ivec, sizeof(xor_1)); } else #endif @@ -154,8 +152,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) /* get input */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input++,(char *)&t_input[0],sizeof(t_input[0])); - bcopy((char *)input++,(char *)&t_input[1],sizeof(t_input[0])); + memcpy((char *)&t_input[0], (char *)input++, sizeof(t_input[0])); + memcpy((char *)&t_input[1], (char *)input++, sizeof(t_input[0])); } else #endif @@ -185,10 +183,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) /* copy temp output */ #ifdef MUSTALIGN if ((afs_int32) output & 3) { - bcopy((char *)&t_output[0],(char *)output++, - sizeof(t_output[0])); - bcopy((char *)&t_output[1],(char *)output++, - sizeof(t_output[1])); + memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); + memcpy((char *)output++, (char *)&t_output[1], sizeof(t_output[1])); } else #endif diff --git a/src/des/cksum.c b/src/des/cksum.c index 8d42fb3..4df1731 100644 --- a/src/des/cksum.c +++ b/src/des/cksum.c @@ -75,8 +75,8 @@ des_cbc_cksum(in,out,length,key,iv) #ifdef MUSTALIGN if ((afs_int32) ivec & 3) { - bcopy((char *)ivec++,(char *)&t_output[0],sizeof(t_output[0])); - bcopy((char *)ivec,(char *)&t_output[1],sizeof(t_output[1])); + memcpy((char *)&t_output[0], (char *)ivec++, sizeof(t_output[0])); + memcpy((char *)&t_output[1], (char *)ivec, sizeof(t_output[1])); } else #endif @@ -89,8 +89,8 @@ des_cbc_cksum(in,out,length,key,iv) /* get input */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input++,(char *)&t_input[0],sizeof(t_input[0])); - bcopy((char *)input++,(char *)&t_input[1],sizeof(t_input[1])); + memcpy((char *)&t_input[0], (char *)input++, sizeof(t_input[0])); + memcpy((char *)&t_input[1], (char *)input++, sizeof(t_input[1])); } else #endif @@ -127,8 +127,8 @@ des_cbc_cksum(in,out,length,key,iv) /* copy temp output and save it for checksum */ #ifdef MUSTALIGN if ((afs_int32) output & 3) { - bcopy((char *)&t_output[0],(char *)output++,sizeof(t_output[0])); - bcopy((char *)&t_output[1],(char *)output,sizeof(t_output[1])); + memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); + memcpy((char *)output, (char *)&t_output[1], sizeof(t_output[1])); } else #endif diff --git a/src/des/des.c b/src/des/des.c index 4f4acbd..491bba8 100644 --- a/src/des/des.c +++ b/src/des/des.c @@ -130,8 +130,8 @@ des_ecb_encrypt(clear, cipher, schedule, encrypt) } #endif if ((afs_int32) clear & 3) { - bcopy((char *)clear++,(char *)&L_save,sizeof(L_save)); - bcopy((char *)clear,(char *)&R_save,sizeof(R_save)); + memcpy((char *)&L_save, (char *)clear++, sizeof(L_save)); + memcpy((char *)&R_save, (char *)clear, sizeof(R_save)); L1 = L_save; R1 = R_save; } @@ -442,8 +442,8 @@ des_ecb_encrypt(clear, cipher, schedule, encrypt) if ((afs_int32) cipher & 3) { L_save = L2; /* cant bcopy a reg */ R_save = R2; - bcopy((char *)&L_save,(char *)cipher++,sizeof(L_save)); - bcopy((char *)&R_save,(char *)cipher,sizeof(R_save)); + memcpy((char *)cipher++, (char *)&L_save, sizeof(L_save)); + memcpy((char *)cipher, (char *)&R_save, sizeof(R_save)); } else #endif diff --git a/src/des/enc.c b/src/des/enc.c index eb74847..0bbee6f 100644 --- a/src/des/enc.c +++ b/src/des/enc.c @@ -74,7 +74,7 @@ main(argc,argv) } ivec[0] = 0; ivec[1] = 0; - bcopy(key,sum,sizeof(C_Block)); + memcpy(sum, key, sizeof(C_Block)); for (;;) { if ((length = read (ind, inbuf, 512)) < 0) { fprintf (stderr, "%s: Error reading from input.\n", diff --git a/src/des/new_rnd_key.c b/src/des/new_rnd_key.c index 304cf9c..6b10308 100644 --- a/src/des/new_rnd_key.c +++ b/src/des/new_rnd_key.c @@ -243,8 +243,7 @@ static afs_int32 des_set_sequence_number(des_cblock new_sequence_number) { LOCK_RANDOM - bcopy((char *)new_sequence_number, (char *)sequence_number, - sizeof(sequence_number)); + memcpy((char *)sequence_number, (char *)new_sequence_number, sizeof(sequence_number)); UNLOCK_RANDOM return 0; } diff --git a/src/des/pcbc_encrypt.c b/src/des/pcbc_encrypt.c index 21a920a..66676bb 100644 --- a/src/des/pcbc_encrypt.c +++ b/src/des/pcbc_encrypt.c @@ -88,8 +88,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) if (encrypt) { #ifdef MUSTALIGN if ((afs_int32) ivec & 3) { - bcopy((char *)ivec++,(char *)&xor_0,sizeof(xor_0)); - bcopy((char *)ivec,(char *)&xor_1,sizeof(xor_1)); + memcpy((char *)&xor_0, (char *)ivec++, sizeof(xor_0)); + memcpy((char *)&xor_1, (char *)ivec, sizeof(xor_1)); } else #endif @@ -102,8 +102,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) /* get input */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input,(char *)&t_input[0],sizeof(t_input[0])); - bcopy((char *)(input+1),(char *)&t_input[1],sizeof(t_input[1])); + memcpy((char *)&t_input[0], (char *)input, sizeof(t_input[0])); + memcpy((char *)&t_input[1], (char *)(input+1), sizeof(t_input[1])); } else #endif @@ -135,9 +135,9 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input++,(char *)&xor_0,sizeof(xor_0)); + memcpy((char *)&xor_0, (char *)input++, sizeof(xor_0)); xor_0 ^= t_output[0]; - bcopy((char *)input++,(char *)&xor_1,sizeof(xor_1)); + memcpy((char *)&xor_1, (char *)input++, sizeof(xor_1)); xor_1 ^= t_output[1]; } else @@ -151,10 +151,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) /* copy temp output and save it for cbc */ #ifdef MUSTALIGN if ((afs_int32) output & 3) { - bcopy((char *)&t_output[0],(char *)output++, - sizeof(t_output[0])); - bcopy((char *)&t_output[1],(char *)output++, - sizeof(t_output[1])); + memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); + memcpy((char *)output++, (char *)&t_output[1], sizeof(t_output[1])); } else #endif @@ -181,8 +179,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) /* decrypt */ #ifdef MUSTALIGN if ((afs_int32) ivec & 3) { - bcopy((char *)ivec++,(char *)&xor_0,sizeof(xor_0)); - bcopy((char *)ivec,(char *)&xor_1,sizeof(xor_1)); + memcpy((char *)&xor_0, (char *)ivec++, sizeof(xor_0)); + memcpy((char *)&xor_1, (char *)ivec, sizeof(xor_1)); } else #endif @@ -195,8 +193,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) /* get input */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input++,(char *)&t_input[0],sizeof(t_input[0])); - bcopy((char *)input++,(char *)&t_input[1],sizeof(t_input[1])); + memcpy((char *)&t_input[0], (char *)input++, sizeof(t_input[0])); + memcpy((char *)&t_input[1], (char *)input++, sizeof(t_input[1])); } else #endif @@ -226,10 +224,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) /* copy temp output */ #ifdef MUSTALIGN if ((afs_int32) output & 3) { - bcopy((char *)&t_output[0],(char *)output++, - sizeof(t_output[0])); - bcopy((char *)&t_output[1],(char *)output++, - sizeof(t_output[1])); + memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); + memcpy((char *)output++, (char *)&t_output[1], sizeof(t_output[1])); } else #endif diff --git a/src/des/read_pssword.c b/src/des/read_pssword.c index b10972f..5249652 100644 --- a/src/des/read_pssword.c +++ b/src/des/read_pssword.c @@ -108,7 +108,7 @@ des_read_password(k,prompt,verify) #ifdef BSDUNIX lose: #endif - bzero(key_string, sizeof (key_string)); + memset(key_string, 0, sizeof (key_string)); return ok; } @@ -216,7 +216,7 @@ des_read_pw_string(s,maxa,prompt,verify) #else #ifdef BSDUNIX /* XXX assume jmp_buf is typedef'ed to an array */ - bcopy((char *)old_env, (char *)env, sizeof(env)); + memcpy((char *)env, (char *)old_env, sizeof(env)); if (setjmp(env)) goto lose; /* save terminal state*/ @@ -224,7 +224,7 @@ des_read_pw_string(s,maxa,prompt,verify) return -1; push_signals(); /* Turn off echo */ - bcopy (&tty_state, &echo_off_tty_state, sizeof (tty_state)); + memcpy(&echo_off_tty_state, &tty_state, sizeof (tty_state)); echo_off_tty_state.sg_flags &= ~ECHO; if (ioctl(0,TIOCSETP,(char *)&echo_off_tty_state) == -1) return -1; @@ -277,7 +277,7 @@ des_read_pw_string(s,maxa,prompt,verify) } continue; } - if ((ptr = index(s, '\n'))) + if ((ptr = strchr(s, '\n'))) *ptr = '\0'; #endif if (verify) { @@ -292,7 +292,7 @@ des_read_pw_string(s,maxa,prompt,verify) clearerr(stdin); continue; } - if ((ptr = index(key_string, '\n'))) + if ((ptr = strchr(key_string, '\n'))) *ptr = '\0'; #endif if (strcmp(s,key_string)) { @@ -308,7 +308,7 @@ des_read_pw_string(s,maxa,prompt,verify) lose: #endif if (!ok) - bzero(s, maxa); + memset(s, 0, maxa); printf("\n"); #if defined(AFS_HPUX_ENV) || defined(AFS_FBSD_ENV) /* @@ -339,7 +339,7 @@ lose: if (ioctl(0,TIOCSETP,(char *)&tty_state)) ok = 0; pop_signals(); - bcopy((char *)env, (char *)old_env, sizeof(env)); + memcpy((char *)old_env, (char *)env, sizeof(env)); #else #if defined (AFS_AIX_ENV) /*|| defined (AFS_HPUX_ENV)*/ || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) ttyb.c_lflag = flags; @@ -362,7 +362,7 @@ lose: #endif #endif if (verify) - bzero(key_string, sizeof (key_string)); + memset(key_string, 0, sizeof (key_string)); s[maxa-1] = 0; /* force termination */ return !ok; /* return nonzero if not okay */ } diff --git a/src/des/strng_to_key.c b/src/des/strng_to_key.c index 70d2651..2854c45 100644 --- a/src/des/strng_to_key.c +++ b/src/des/strng_to_key.c @@ -68,7 +68,7 @@ des_string_to_key(str,key) length = strlen(str); /* init key array for bits */ - bzero(k_char,sizeof(k_char)); + memset(k_char, 0, sizeof(k_char)); #ifdef DEBUG if (des_debug) @@ -117,7 +117,7 @@ des_string_to_key(str,key) (void) des_key_sched(key,key_sked); (void) des_cbc_cksum((des_cblock *)in_str,key,length,key_sked,key); /* erase key_sked */ - bzero((char *)key_sked,sizeof(key_sked)); + memset((char *)key_sked, 0, sizeof(key_sked)); /* now fix up key parity again */ des_fixup_key_parity(key); diff --git a/src/des/weak_key.c b/src/des/weak_key.c index a00bbd4..04d0391 100644 --- a/src/des/weak_key.c +++ b/src/des/weak_key.c @@ -70,7 +70,7 @@ des_is_weak_key(key) const des_cblock *weak_p = weak; for (i = 0; i < (sizeof(weak)/sizeof(des_cblock)); i++) { - if (!bcmp((char *)weak_p++,(char *)key,sizeof(des_cblock))) + if (!memcmp((char *)weak_p++,(char *)key,sizeof(des_cblock))) return 1; } diff --git a/src/dir/salvage.c b/src/dir/salvage.c index 1319680..83468d6 100644 --- a/src/dir/salvage.c +++ b/src/dir/salvage.c @@ -398,8 +398,8 @@ int DirSalvage (fromFile, toFile, vn, vu, pvn, pvu) struct DirEntry *ep; int entry; - bzero(dot, sizeof(dot)); - bzero(dotdot, sizeof(dotdot)); + memset(dot, 0, sizeof(dot)); + memset(dotdot, 0, sizeof(dotdot)); dot[1] = vn; dot[2] = vu; dotdot[1] = pvn; diff --git a/src/dir/test/dtest.c b/src/dir/test/dtest.c index 7c4bcf6..0f8e9a5 100644 --- a/src/dir/test/dtest.c +++ b/src/dir/test/dtest.c @@ -157,7 +157,7 @@ int count; { dirhandle dir; CreateDir(dname, &dir); - bzero(fid, sizeof(fid)); + memset(fid, 0, sizeof(fid)); MakeDir(&dir, fid, fid); for(i=0;in_zeroes != xsq->n_zeroes diff --git a/src/export/symtab.c b/src/export/symtab.c index f01de67..16b4c47 100644 --- a/src/export/symtab.c +++ b/src/export/symtab.c @@ -41,7 +41,7 @@ char *name; { */ if (sym = symsrch(name)) return sym; - bcopy(name, buf+1, sizeof (buf) - 2); + memcpy(buf+1, name, sizeof (buf) - 2); buf[0] = '.'; if (sym = symsrch(buf)) diff --git a/src/fsprobe/fsprobe.c b/src/fsprobe/fsprobe.c index 622ff9c..895980c 100644 --- a/src/fsprobe/fsprobe.c +++ b/src/fsprobe/fsprobe.c @@ -95,7 +95,7 @@ static int fsprobe_CleanupInit() struct interfaceAddr *interfaceAddr; /*Bogus param*/ fsprobe_ConnInfo = (struct fsprobe_ConnectionInfo *)0; - bzero(fsprobe_Results, sizeof(struct fsprobe_ProbeResults)); + memset(&fsprobe_Results, 0, sizeof(struct fsprobe_ProbeResults)); rxcall = (struct rx_call *)0; Fids_Array = (AFSCBFids *)0; @@ -253,8 +253,8 @@ static void fsprobe_LWP() curr_stats = fsprobe_Results.stats; curr_probeOK = fsprobe_Results.probeOK; fsprobe_Results.probeNum++; - bzero(fsprobe_Results.stats, fsprobe_statsBytes); - bzero(fsprobe_Results.probeOK, fsprobe_probeOKBytes); + memset(fsprobe_Results.stats, 0, fsprobe_statsBytes); + memset(fsprobe_Results.probeOK, 0, fsprobe_probeOKBytes); for (conn_idx = 0; conn_idx < fsprobe_numServers; conn_idx++) { /* @@ -553,8 +553,7 @@ int fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, fsprobe_Results.probeNum = 0; fsprobe_Results.probeTime = 0; - bzero(fsprobe_Results.stats, - (a_numServers * sizeof(struct ProbeViceStatistics))); + memset(fsprobe_Results.stats, 0, (a_numServers * sizeof(struct ProbeViceStatistics))); /* * Initialize the Rx subsystem, just in case nobody's done it. @@ -624,9 +623,7 @@ int fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, (a_socketArray + curr_srv)->sin_addr.s_addr, (a_socketArray + curr_srv)->sin_port); } - bcopy(a_socketArray + curr_srv, - &(curr_conn->skt), - sizeof(struct sockaddr_in)); + memcpy(&(curr_conn->skt), a_socketArray + curr_srv, sizeof(struct sockaddr_in)); hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr); if (hostNameFound == (char *)0) { @@ -687,7 +684,7 @@ int fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, } else { int i, cnt; - bzero(&curr_conn->partList, sizeof(struct partList)); + memset(&curr_conn->partList, 0, sizeof(struct partList)); curr_conn->partCnt = 0; i = XListPartitions(curr_conn->rxVolconn, &curr_conn->partList, &cnt); if (!i) { diff --git a/src/fsprobe/fsprobe_test.c b/src/fsprobe/fsprobe_test.c index 7bdac98..2f2808c 100644 --- a/src/fsprobe/fsprobe_test.c +++ b/src/fsprobe/fsprobe_test.c @@ -158,7 +158,7 @@ main(argc, argv) fprintf(stderr, "[%s] Can't get host info for servername1\n", rn); exit(-1); } - bcopy(he->h_addr, &(FSSktArray[0].sin_addr.s_addr), 4); + memcpy(&(FSSktArray[0].sin_addr.s_addr), he->h_addr, 4); FSSktArray[1].sin_family = htons(AF_INET); /*Internet address family*/ FSSktArray[1].sin_port = htons(7000); /*FileServer port*/ @@ -167,7 +167,7 @@ main(argc, argv) fprintf(stderr, "[%s] Can't get host info for servername2\n", rn); exit(-1); } - bcopy(he->h_addr, &(FSSktArray[1].sin_addr.s_addr), 4); + memcpy(&(FSSktArray[1].sin_addr.s_addr), he->h_addr, 4); FSSktArray[2].sin_family = htons(AF_INET); /*Internet address family*/ FSSktArray[2].sin_port = htons(7000); /*FileServer port*/ @@ -176,7 +176,7 @@ main(argc, argv) fprintf(stderr, "[%s] Can't get host info for servername3\n", rn); exit(-1); } - bcopy(he->h_addr, &(FSSktArray[2].sin_addr.s_addr), 4); + memcpy(&(FSSktArray[2].sin_addr.s_addr), he->h_addr, 4); printf("Sockets for the 3 AFS FileServers to be probed:\n"); printf("\t Host servername1: IP addr 0x%lx, port %d\n", diff --git a/src/ftpd43+/ftpcmd.y b/src/ftpd43+/ftpcmd.y index 472676b..d74f605 100644 --- a/src/ftpd43+/ftpcmd.y +++ b/src/ftpd43+/ftpcmd.y @@ -980,7 +980,7 @@ yylex() if (strncasecmp(cbuf, "PASS", 4) != NULL) setproctitle("%s: %s", proctitle, cbuf); #endif /* SETPROCTITLE */ - if ((cp = index(cbuf, '\r'))) { + if ((cp = strchr(cbuf, '\r'))) { *cp++ = '\n'; *cp = '\0'; } diff --git a/src/ftpd43+/ftpd.c b/src/ftpd43+/ftpd.c index d91a96f..5ac9ca1 100644 --- a/src/ftpd43+/ftpd.c +++ b/src/ftpd43+/ftpd.c @@ -347,7 +347,7 @@ nextopt: syslog(LOG_ERR, MSGSTR(SOCKOPT, "setsockopt: %m")); /* set-up signal handler routines for SRC TRACE ON/OFF support */ - bzero((char *)&sa, sizeof(sa)); + memset((char *)&sa, 0, sizeof(sa)); sa.sa_mask.losigs = sigmask(SIGUSR2); sa.sa_handler = trace_handler; sigaction(SIGUSR1, &sa, (struct sigaction *)0); diff --git a/src/ftpd43+/logwtmp.c b/src/ftpd43+/logwtmp.c index e09ea0f..ecc4646 100644 --- a/src/ftpd43+/logwtmp.c +++ b/src/ftpd43+/logwtmp.c @@ -49,7 +49,7 @@ logwtmp(line, name, host) return; } - bzero((char *)&ut, sizeof(ut)); + memset((char *)&ut, 0, sizeof(ut)); if (!fstat(fd, &buf)) { (void)strncpy(ut.ut_line, line, sizeof(ut.ut_line)); (void)strncpy(ut.ut_name, name, sizeof(ut.ut_name)); diff --git a/src/ftpd43+/popen.c b/src/ftpd43+/popen.c index 4cf0cb6..2d25c75 100644 --- a/src/ftpd43+/popen.c +++ b/src/ftpd43+/popen.c @@ -57,7 +57,7 @@ ftpd_popen(program, type) if (!(pids = (uid_t *)malloc((u_int)(fds * sizeof(uid_t))))) return(NULL); - bzero(pids, fds * sizeof(uid_t)); + memset(pids, 0, fds * sizeof(uid_t)); } if (pipe(pdes) < 0) return(NULL); @@ -137,7 +137,7 @@ ftpd_pclose(iop) if (pids[fdes = fileno(iop)] == 0) return(-1); (void)fclose(iop); - bzero((char *)someSignals, sizeof(someSignals)); + memset((char *)someSignals, 0, sizeof(someSignals)); someSignals[0] = (1<<(SIGINT-1)) + (1<<(SIGQUIT-1)) + (1<<(SIGHUP-1)); sigBlock = *((sigset_t *) someSignals); sigprocmask(SIG_BLOCK, &sigBlock, &oset); diff --git a/src/gtx/frame.c b/src/gtx/frame.c index 44906e8..5f133d2 100644 --- a/src/gtx/frame.c +++ b/src/gtx/frame.c @@ -200,7 +200,7 @@ struct gtx_frame *aframe; { tmenu = (struct gtxframe_menu *) malloc(sizeof(*tmenu)); if (tmenu == (struct gtxframe_menu *)0) return(-1); - bzero(tmenu, sizeof(*tmenu)); + memset(tmenu, 0, sizeof(*tmenu)); tmenu->next = aframe->menus; aframe->menus = tmenu; tmenu->name = gtx_CopyString(alabel); @@ -342,7 +342,7 @@ struct gtx_frame *aframe; { WOP_GETDIMENSIONS(aframe->window, &sizeparms); if (aframe->promptLine) { - bzero(&strparms, sizeof(strparms)); + memset(&strparms, 0, sizeof(strparms)); strparms.x = 0; strparms.y = sizeparms.maxy-1; strparms.highlight = 1; @@ -354,7 +354,7 @@ struct gtx_frame *aframe; { } else if (aframe->messageLine) { /* Otherwise we're visible, print the message at the bottom */ - bzero(&strparms, sizeof(strparms)); + memset(&strparms, 0, sizeof(strparms)); strparms.highlight = 1; strparms.x = 0; strparms.y = sizeparms.maxy-1; @@ -418,7 +418,7 @@ struct gtx_frame *gtxframe_Create() { * Now that all the pieces exist, fill them in and stick them in * the right places. */ - bzero(tframe, sizeof(struct gtx_frame)); + memset(tframe, 0, sizeof(struct gtx_frame)); tframe->keymap = newkeymap; tframe->keystate = newkeystate; keymap_InitState(tframe->keystate, tframe->keymap); @@ -460,7 +460,7 @@ register struct gtx_frame *aframe; { strcat(menubuffer, " "); } if (menubuffer[0] != 0) { - bzero(&strparms, sizeof(strparms)); + memset(&strparms, 0, sizeof(strparms)); strparms.x = 0; strparms.y = 0; strparms.s = menubuffer; diff --git a/src/gtx/keymap.c b/src/gtx/keymap.c index a6cdfc0..b33b8e6 100644 --- a/src/gtx/keymap.c +++ b/src/gtx/keymap.c @@ -19,7 +19,7 @@ struct keymap_map *keymap_Create() { tmap = (struct keymap_map *) malloc(sizeof(struct keymap_map)); if (tmap != (struct keymap_map *)0) - bzero(tmap, sizeof(*tmap)); + memset(tmap, 0, sizeof(*tmap)); return(tmap); } @@ -125,7 +125,7 @@ register struct keymap_map *amap; { keymap_InitState(astate, amap) register struct keymap_state *astate; struct keymap_map *amap; { - bzero(astate, sizeof(*astate)); + memset(astate, 0, sizeof(*astate)); astate->initMap = amap; astate->currentMap = amap; return 0; diff --git a/src/gtx/textcb.c b/src/gtx/textcb.c index 5ddf782..584c96f 100644 --- a/src/gtx/textcb.c +++ b/src/gtx/textcb.c @@ -169,7 +169,7 @@ struct gator_textcb_hdr *gator_textcb_Create(a_maxEntriesStored, a_maxCharsPerEn */ if (gator_textcb_debug) fprintf(stderr, "[%s] Zeroing %d bytes in text buffer at 0x%x\n", rn, numBuffBytes, newBuff); - bzero(newBuff, numBuffBytes); + memset(newBuff, 0, numBuffBytes); if (gator_textcb_debug) fprintf(stderr, "[%s] Initializing blank line buffer at 0x%x\n", rn, blankLine); @@ -190,7 +190,7 @@ struct gator_textcb_hdr *gator_textcb_Create(a_maxEntriesStored, a_maxCharsPerEn curr_ent->numInversions = 0; curr_ent->charsUsed = 0; curr_ent->textp = curr_buff; - bcopy(blankLine, curr_ent->textp, a_maxCharsPerEntry+1); + memcpy(curr_ent->textp, blankLine, a_maxCharsPerEntry+1); for (curr_inv = 0; curr_inv < GATOR_TEXTCB_MAXINVERSIONS; curr_inv++) curr_ent->inversion[curr_inv] = 0; @@ -266,7 +266,7 @@ static struct gator_textcb_entry *bumpEntry(a_cbhdr) * Copy over a blank line into the one we're initializing. We * copy over the trailing null, too. */ - bcopy(a_cbhdr->blankLine, curr_ent->textp, a_cbhdr->maxCharsPerEntry+1); + memcpy(curr_ent->textp, a_cbhdr->blankLine, a_cbhdr->maxCharsPerEntry+1); for (inv=0; inv < GATOR_TEXTCB_MAXINVERSIONS; inv++) curr_ent->inversion[inv] = 0; diff --git a/src/inetd/inetd.c b/src/inetd/inetd.c index ab716f9..4a0f5a1 100644 --- a/src/inetd/inetd.c +++ b/src/inetd/inetd.c @@ -194,7 +194,7 @@ main(argc, argv, envp) #endif /* defined(AFS_HPUX_ENV) */ memset((char *)allZeroes, '\0', sizeof(allZeroes)); - bzero((char *)allZeroes, sizeof(allZeroes)); + memset((char *)allZeroes, 0, sizeof(allZeroes)); sigNone = *((sigset_t *) allZeroes); allZeroes[0] = (1<<(SIGCHLD-1)) + (1<<(SIGHUP-1)) + (1<<(SIGALRM-1)); @@ -475,7 +475,7 @@ main(argc, argv, envp) inet_ntoa(his_addr.sin_addr.s_addr), ntohs(his_addr.sin_port)); execl(sep->se_server, - rindex(sep->se_server, '/')+1, + strrchr(sep->se_server, '/')+1, sep->se_socktype == SOCK_DGRAM ? (char *)0 : addrbuf, (char *)0); } else diff --git a/src/inetd/setenv.c b/src/inetd/setenv.c index da3b299..ec9eaea 100644 --- a/src/inetd/setenv.c +++ b/src/inetd/setenv.c @@ -66,7 +66,7 @@ setenv(name, value, rewrite) (cnt + 2))); if (!P) return(-1); - bcopy(environ, P, cnt * sizeof(char *)); + memcpy(P, environ, cnt * sizeof(char *)); environ = P; } environ[cnt + 1] = NULL; diff --git a/src/inetd/ta-rauth.c b/src/inetd/ta-rauth.c index c80d303..29e59c5 100644 --- a/src/inetd/ta-rauth.c +++ b/src/inetd/ta-rauth.c @@ -177,7 +177,7 @@ outtoken(s,token,svc,localName) /* (4) sessionKey */ bp = buf + strlen(buf); - bcopy(&token->sessionKey,bp,8); + memcpy(bp, &token->sessionKey, 8); bp += 8; /* (5) - (6) */ @@ -185,7 +185,7 @@ outtoken(s,token,svc,localName) /* (7) ticket */ bp += strlen(bp); - bcopy(token->ticket, bp, token->ticketLen); + memcpy(bp, token->ticket, token->ticketLen); bp += token->ticketLen; if((count = write(s, buf, (int)(bp - buf))) == -1) { diff --git a/src/kauth/admin_tools.c b/src/kauth/admin_tools.c index 11b02ed..8675c8d 100644 --- a/src/kauth/admin_tools.c +++ b/src/kauth/admin_tools.c @@ -637,7 +637,7 @@ int SetFields ( hrs = 0; s = as->parms[7].items->data; - if (index(s, ':')) + if (strchr(s, ':')) sscanf(s, "%d:%d", &hrs, &mins); else sscanf(s, "%d", &mins); @@ -1328,7 +1328,7 @@ static int MyBeforeProc( if (code) { /* if not then get key and try again */ if (as->parms[13].items) { /* if password specified */ strncpy (passwd, as->parms[13].items->data, sizeof(passwd)); - bzero (as->parms[13].items->data, strlen (as->parms[13].items->data)); + memset(as->parms[13].items->data, 0, strlen (as->parms[13].items->data)); } else { char msg[MAXKTCNAMELEN+50]; if (as->parms[12].items) sprintf (msg, "Administrator's (%s) Password: ", name); @@ -1391,7 +1391,7 @@ static int MyBeforeProc( "getting Authentication token for %s", PrintedName (name, instance, cell)); } - bzero (&key, sizeof(key)); + memset(&key, 0, sizeof(key)); } } diff --git a/src/kauth/authclient.c b/src/kauth/authclient.c index c86e9b7..e92abfb 100644 --- a/src/kauth/authclient.c +++ b/src/kauth/authclient.c @@ -365,7 +365,7 @@ static afs_int32 CheckTicketAnswer( cksum = ntohl(answer->cksum); if (challenge != ntohl(answer->challenge)) return KABADPROTOCOL; - bcopy (&answer->sessionKey, &token->sessionKey, sizeof(token->sessionKey)); + memcpy(&token->sessionKey, &answer->sessionKey, sizeof(token->sessionKey)); token->startTime = ntohl(answer->startTime); token->endTime = ntohl(answer->endTime); token->kvno = (short) ntohl(answer->kvno); @@ -401,9 +401,9 @@ static afs_int32 CheckTicketAnswer( ) return KABADPROTOCOL; - bcopy (strings, token->ticket, token->ticketLen); + memcpy(token->ticket, strings, token->ticketLen); strings += token->ticketLen; - if (bcmp (strings, label, KA_LABELSIZE) != 0) return KABADPROTOCOL; + if (memcmp (strings, label, KA_LABELSIZE) != 0) return KABADPROTOCOL; if (pwexpires) { afs_int32 temp; @@ -412,7 +412,7 @@ static afs_int32 CheckTicketAnswer( if (oanswer->SeqLen > temp) { strings = oanswer->SeqBody + temp; - bcopy (strings, &temp, sizeof(afs_int32)); + memcpy(&temp, strings, sizeof(afs_int32)); tempc = ntohl(temp) >> 24; /* don't forget this if you add any more fields! strings += sizeof(afs_int32); @@ -525,7 +525,7 @@ afs_int32 ka_Authenticate ( request_time = time(0); request.time = htonl(request_time); - bcopy (req_label, request.label, sizeof(request.label)); + memcpy(request.label, req_label, sizeof(request.label)); arequest.SeqLen = sizeof(request); arequest.SeqBody = (char *)&request; des_pcbc_encrypt (arequest.SeqBody, arequest.SeqBody, arequest.SeqLen, @@ -599,9 +599,8 @@ afs_int32 ka_Authenticate ( token->endTime = end; token->kvno = ntohl(answer_old.kvno); token->ticketLen = answer_old.ticket_len; - bcopy (answer_old.ticket, token->ticket, sizeof(token->ticket)); - bcopy (&answer_old.sessionkey, &token->sessionKey, - sizeof(struct ktc_encryptionKey)); + memcpy(token->ticket, answer_old.ticket, sizeof(token->ticket)); + memcpy(&token->sessionKey, &answer_old.sessionkey, sizeof(struct ktc_encryptionKey)); } break; default: @@ -705,8 +704,7 @@ afs_int32 ka_GetToken ( token->endTime = ntohl(answer_old.endTime); token->ticketLen = ntohl(answer_old.ticketLen); token->kvno = ntohl(answer_old.kvno); - bcopy (&answer_old.sessionKey, &token->sessionKey, - sizeof(token->sessionKey)); + memcpy(&token->sessionKey, &answer_old.sessionKey, sizeof(token->sessionKey)); if (tkt_CheckTimes (token->startTime, token->endTime, time(0)) < 0) { UNLOCK_GLOBAL_MUTEX @@ -756,7 +754,7 @@ afs_int32 ka_GetToken ( UNLOCK_GLOBAL_MUTEX return KABADPROTOCOL; } - bcopy (strings, token->ticket, token->ticketLen); + memcpy(token->ticket, strings, token->ticketLen); break; default: diff --git a/src/kauth/client.c b/src/kauth/client.c index 7d8a50f..1a29000 100644 --- a/src/kauth/client.c +++ b/src/kauth/client.c @@ -58,7 +58,7 @@ static void Andrew_StringToKey ( int i; int passlen; - bzero (key, sizeof(struct ktc_encryptionKey)); + memset(key, 0, sizeof(struct ktc_encryptionKey)); strncpy (password, cell, 8); passlen = strlen (str); @@ -106,13 +106,13 @@ static void StringToKey ( if ((passlen = strlen(password)) > sizeof(password)) passlen = sizeof(password); - bcopy ("kerberos", ivec, 8); - bcopy ("kerberos", temp_key, 8); + memcpy(ivec, "kerberos", 8); + memcpy(temp_key, "kerberos", 8); des_fixup_key_parity (temp_key); des_key_sched (temp_key, schedule); des_cbc_cksum (password, ivec, passlen, schedule, ivec); - bcopy (ivec, temp_key, 8); + memcpy(temp_key, ivec, 8); des_fixup_key_parity (temp_key); des_key_sched (temp_key, schedule); des_cbc_cksum (password, key, passlen, schedule, ivec); @@ -158,7 +158,7 @@ afs_int32 ka_ReadPassword ( afs_int32 code; LOCK_GLOBAL_MUTEX - bzero (key, sizeof(struct ktc_encryptionKey)); + memset(key, 0, sizeof(struct ktc_encryptionKey)); code = read_pw_string (password, sizeof(password), prompt, verify); if (code) { UNLOCK_GLOBAL_MUTEX diff --git a/src/kauth/kadatabase.c b/src/kauth/kadatabase.c index ab3e7f6..e70b30d 100644 --- a/src/kauth/kadatabase.c +++ b/src/kauth/kadatabase.c @@ -166,7 +166,7 @@ afs_int32 CheckInit (at, db_init) printf ("Error discovered in header, rebuilding.\n"); /* try to write a good header */ - bzero(&cheader,sizeof(cheader)); + memset(&cheader, 0, sizeof(cheader)); cheader.version = htonl(KADBVERSION); cheader.checkVersion = htonl(KADBVERSION); cheader.headerSize = htonl(sizeof(cheader)); @@ -208,7 +208,7 @@ afs_int32 AllocBlock (at, tentry) code = inc_header_word (at, stats.allocs); if (code) return 0; - bzero (tentry, sizeof(kaentry)); /* zero new entry */ + memset(tentry, 0, sizeof(kaentry)); /* zero new entry */ return temp; } @@ -224,7 +224,7 @@ afs_int32 FreeBlock (at, index) /* check index just to be on the safe side */ if (!index_OK (index)) return KABADINDEX; - bzero (&tentry, sizeof(kaentry)); + memset(&tentry, 0, sizeof(kaentry)); tentry.next = cheader.freePtr; tentry.flags = htonl(KAFFREE); code = set_header_word (at, freePtr, htonl(index)); @@ -444,7 +444,7 @@ afs_int32 ka_NewKey (tt, tentryaddr, tentry, key) ((now - ntohl(okeys.keys[i].superseded) > maxKeyLifetime)) ) { okeys.keys[i].superseded = 0; okeys.keys[i].version = htonl(-1); - bzero(&okeys.keys[i].key, sizeof(struct ktc_encryptionKey)); + memset(&okeys.keys[i].key, 0, sizeof(struct ktc_encryptionKey)); modified = 1; es_Report ("Dropped oldkey %d seconds old with kvno %d\n", @@ -456,7 +456,7 @@ afs_int32 ka_NewKey (tt, tentryaddr, tentry, key) if (!addednewkey && (okeys.keys[i].superseded == 0)) { okeys.keys[i].version = htonl(newkeyver); okeys.keys[i].superseded = htonl(NEVERDATE); - bcopy (key, &okeys.keys[i].key, sizeof(struct ktc_encryptionKey)); + memcpy(&okeys.keys[i].key, key, sizeof(struct ktc_encryptionKey)); modified = 1; addednewkey = okeysaddr; } @@ -498,7 +498,7 @@ afs_int32 ka_NewKey (tt, tentryaddr, tentry, key) okeys.entry = htonl(tentryaddr); okeys.keys[0].version = htonl(newkeyver); okeys.keys[0].superseded = htonl(NEVERDATE); - bcopy (key, &okeys.keys[0].key, sizeof(struct ktc_encryptionKey)); + memcpy(&okeys.keys[0].key, key, sizeof(struct ktc_encryptionKey)); newtotalkeyentries++; /* Thread onto the header's chain of oldkeys */ @@ -525,7 +525,7 @@ afs_int32 ka_NewKey (tt, tentryaddr, tentry, key) tentry->misc.asServer.oldKeys = htonl(addednewkey); tentry->misc.asServer.nOldKeys = htonl(newtotalkeyentries); tentry->key_version = htonl(newkeyver); - bcopy (key, &tentry->key, sizeof (tentry->key)); + memcpy(&tentry->key, key, sizeof (tentry->key)); /* invalidate key caches everywhere */ code = inc_header_word (tt, specialKeysVersion); @@ -594,8 +594,8 @@ void ka_debugKeyCache (info) struct ka_debugInfo *info; { int i; - bcopy (&cheader_lock, &info->cheader_lock, sizeof (info->cheader_lock)); - bcopy (&keycache_lock, &info->keycache_lock, sizeof (info->keycache_lock)); + memcpy(&info->cheader_lock, &cheader_lock, sizeof (info->cheader_lock)); + memcpy(&info->keycache_lock, &keycache_lock, sizeof (info->keycache_lock)); info->kcVersion = keyCacheVersion; info->kcSize = maxCachedKeys; @@ -649,7 +649,7 @@ ka_Encache (name, inst, kvno, key, superseded) strncpy (keyCache[i].name, name, sizeof (keyCache[i].name)); strncpy (keyCache[i].inst, inst, sizeof (keyCache[i].inst)); keyCacheVersion = ntohl(cheader.specialKeysVersion); - bcopy (key, &keyCache[i].key, sizeof(*key)); + memcpy(&keyCache[i].key, key, sizeof(*key)); keyCache[i].superseded = superseded; keyCache[i].used = time(0); @@ -697,7 +697,7 @@ afs_int32 ka_LookupKvno (tt, name, inst, kvno, key) if ((keyCache[i].kvno == kvno) && (strcmp(keyCache[i].name, name) == 0) && (strcmp(keyCache[i].inst, inst) == 0)) { - bcopy (&keyCache[i].key, key, sizeof(*key)); + memcpy(key, &keyCache[i].key, sizeof(*key)); keyCache[i].used = time(0); ReleaseReadLock (&keycache_lock); return 0; @@ -717,7 +717,7 @@ afs_int32 ka_LookupKvno (tt, name, inst, kvno, key) /* first check the current key */ if (tentry.key_version == htonl(kvno)) { - bcopy (&tentry.key, key, sizeof(*key)); + memcpy(key, &tentry.key, sizeof(*key)); ka_Encache (name, inst, kvno, key, NEVERDATE); return 0; } @@ -728,7 +728,7 @@ afs_int32 ka_LookupKvno (tt, name, inst, kvno, key) for (i=0; i= autoCPWUpdates) && @@ -137,7 +137,7 @@ static afs_int32 get_time (timeP, tt, admin) if (code) return code; if (to) { /* check if auto cpw is disabled */ if (!(ntohl(tentry.flags) & KAFNOCPW)) { - bcopy (&random_value[0], &key, sizeof(key)); + memcpy(&key, &random_value[0], sizeof(key)); des_fixup_key_parity (&key); code = set_password (tt, KA_ADMIN_NAME, KA_ADMIN_INST, &key, 0, 0); @@ -157,7 +157,7 @@ static afs_int32 get_time (timeP, tt, admin) if (code) return code; if (to) { /* check if auto cpw is disabled */ if (!(ntohl(tentry.flags) & KAFNOCPW)) { - bcopy (&random_value[2], &key, sizeof(key)); + memcpy(&key, &random_value[2], sizeof(key)); des_fixup_key_parity (&key); code = set_password (tt, KA_TGS_NAME, lrealm, &key, 0, 0); if (code == 0) { @@ -518,7 +518,7 @@ static int create_user (tt, name, instance, key, caller, flags) if (code = ka_NewKey (tt, to, &tentry, key)) return code; } else { - bcopy(key, &tentry.key, sizeof(tentry.key)); + memcpy(&tentry.key, key, sizeof(tentry.key)); tentry.key_version = htonl(0); } tentry.user_expiration = htonl(NEVERDATE); @@ -669,9 +669,9 @@ afs_int32 ChangePassWord (call, aname, ainstance, arequest, oanswer) oanswer->SeqLen = answer_len; answer = oanswer->SeqBody; request.time = htonl (request_time+1); - bcopy ((char *)&request.time, answer, sizeof(Date)); + memcpy(answer, (char *)&request.time, sizeof(Date)); answer += sizeof(Date); - bcopy (KA_CPW_ANS_LABEL, answer, KA_LABELSIZE); + memcpy(answer, KA_CPW_ANS_LABEL, KA_LABELSIZE); des_pcbc_encrypt (oanswer->SeqBody, oanswer->SeqBody, answer_len, user_schedule, &tentry.key, ENCRYPT); @@ -720,7 +720,7 @@ impose_reuse_limits ( password, tentry ) if ((now - ntohl(tentry->change_password_time)) < MinHours*60*60) return KATOOSOON; - if (!bcmp(password, &(tentry->key), sizeof(EncryptionKey))) + if (!memcmp(password, &(tentry->key), sizeof(EncryptionKey))) return KAREUSED; code = ka_KeyCheckSum ((char *)password, &newsum); @@ -776,7 +776,7 @@ set_password (tt, name, instance, password, kvno, caller) if (code = ka_NewKey (tt, to, &tentry, password)) return(code); } else { - bcopy (password, &tentry.key, sizeof(tentry.key)); + memcpy(&tentry.key, password, sizeof(tentry.key)); if (!kvno) { kvno = ntohl(tentry.key_version); if ((kvno < 1) || (kvno >= MAXKAKVNO)) @@ -934,7 +934,7 @@ PrepareTicketAnswer answer = (struct ka_ticketAnswer *)oanswer->SeqBody; answer->challenge = htonl(challenge); - bcopy (sessionKey, &answer->sessionKey, sizeof(struct ktc_encryptionKey)); + memcpy(&answer->sessionKey, sessionKey, sizeof(struct ktc_encryptionKey)); answer->startTime = htonl(start); answer->endTime = htonl(end); answer->kvno = server->key_version; @@ -956,10 +956,10 @@ PrepareTicketAnswer putstr (server->userID.name); putstr (server->userID.instance); if (rem < ticketLen+KA_LABELSIZE) return code; - bcopy (ticket, ans, ticketLen); + memcpy(ans, ticket, ticketLen); ans += ticketLen; - if (label) bcopy (label, ans, KA_LABELSIZE); - else bzero (ans, KA_LABELSIZE); + if (label) memcpy(ans, label, KA_LABELSIZE); + else memset(ans, 0, KA_LABELSIZE); ans += KA_LABELSIZE; oanswer->SeqLen = (ans - oanswer->SeqBody); } @@ -1085,7 +1085,7 @@ static afs_int32 Authenticate (version, call, aname, ainstance, start, end, else { /* return our time if possible */ oanswer->SeqLen = sizeof(afs_int32); request.time = htonl(now); - bcopy (&request.time, oanswer->SeqBody, sizeof(afs_int32)); + memcpy(oanswer->SeqBody, &request.time, sizeof(afs_int32)); } #endif code = KACLOCKSKEW; @@ -1098,7 +1098,7 @@ static afs_int32 Authenticate (version, call, aname, ainstance, start, end, if (to == 0) {code = KANOENT; goto abort; } tgskvno = ntohl(server.key_version); - bcopy (&server.key, &tgskey, sizeof(tgskey)); + memcpy(&tgskey, &server.key, sizeof(tgskey)); code = des_random_key (&sessionKey); if (code) { @@ -1127,20 +1127,19 @@ static afs_int32 Authenticate (version, call, aname, ainstance, start, end, oanswer->SeqLen = answer_len; answer = oanswer->SeqBody; answer_time = htonl(request.time+1); - bcopy ((char *)&answer_time, answer, sizeof(Date)); + memcpy(answer, (char *)&answer_time, sizeof(Date)); answer += sizeof(Date); - bcopy ((char *)&sessionKey, answer, sizeof(struct ktc_encryptionKey)); + memcpy(answer, (char *)&sessionKey, sizeof(struct ktc_encryptionKey)); answer += sizeof(struct ktc_encryptionKey); temp = htonl(tgskvno); - bcopy ((char *)&temp, answer, sizeof(afs_int32)); + memcpy(answer, (char *)&temp, sizeof(afs_int32)); answer += sizeof(afs_int32); temp = htonl(ticketLen); - bcopy ((char *)&temp, answer, sizeof(afs_int32)); + memcpy(answer, (char *)&temp, sizeof(afs_int32)); answer += sizeof(afs_int32); - bcopy (ticket, answer, ticketLen); + memcpy(answer, ticket, ticketLen); answer += ticketLen; - bcopy ((tgt ? KA_GETTGT_ANS_LABEL : KA_GETADM_ANS_LABEL), answer, - KA_LABELSIZE); + memcpy(answer, (tgt ? KA_GETTGT_ANS_LABEL : KA_GETADM_ANS_LABEL), KA_LABELSIZE); break; case 1: case 2: @@ -1154,7 +1153,7 @@ static afs_int32 Authenticate (version, call, aname, ainstance, start, end, temp = pwexpires << 24; /* move it into the high byte */ pwexpires = htonl(temp); - bcopy (&pwexpires, (char * )oanswer->SeqBody + oanswer->SeqLen, sizeof(afs_int32)); + memcpy((char * )oanswer->SeqBody + oanswer->SeqLen, &pwexpires, sizeof(afs_int32)); oanswer->SeqLen += sizeof(afs_int32); oanswer->SeqLen = round_up_to_ebs(oanswer->SeqLen); if (oanswer->SeqLen > oanswer->MaxSeqLen) { @@ -1347,7 +1346,7 @@ afs_int32 kamSetFields (call, aname, ainstance, aflags, if (newvals[REUSEFLAGS]) { if (newvals[REUSEFLAGS] & KA_REUSEPW) - bzero(tentry.pwsums, KA_NPWSUMS); + memset(tentry.pwsums, 0, KA_NPWSUMS); else if ((newvals[REUSEFLAGS] & KA_NOREUSEPW) && !tentry.pwsums[0]) tentry.pwsums[0] = 0xff; } @@ -1527,7 +1526,7 @@ afs_int32 kamGetEntry (call, aname, ainstance, aversion, aentry) get_time (0,0,0); /* generate random update */ - bzero (aentry, sizeof(*aentry)); + memset(aentry, 0, sizeof(*aentry)); aentry->minor_version = KAMINORVERSION; aentry->flags = ntohl(tentry.flags); aentry->user_expiration = ntohl(tentry.user_expiration); @@ -1550,8 +1549,8 @@ afs_int32 kamGetEntry (call, aname, ainstance, aversion, aentry) rxkad_GetServerInfo(call->conn, &enc_level, 0, 0, 0, 0, 0); if ((noAuthenticationRequired) || (callerIsAdmin && enc_level == rxkad_crypt)) - bcopy (&tentry.key, &aentry->key, sizeof(struct ktc_encryptionKey)); - else bzero (&aentry->key, sizeof(aentry->key)); + memcpy(&aentry->key, &tentry.key, sizeof(struct ktc_encryptionKey)); + else memset(&aentry->key, 0, sizeof(aentry->key)); code = ka_KeyCheckSum ((char *)&tentry.key, &aentry->keyCheckSum); if (!tentry.pwsums[0] && npwSums > 1 && !tentry.pwsums[1]) { aentry->reserved3 = 0x12340000; @@ -1764,8 +1763,7 @@ static afs_int32 GetTicket (version, call, kvno, authDomain, aticket, sizeof(struct ka_getTicketAnswer) - 5*MAXKTCNAMELEN) goto abort; answer = (struct ka_getTicketAnswer *)oanswer->SeqBody; - bcopy (&sessionKey, &answer->sessionKey, - sizeof(struct ktc_encryptionKey)); + memcpy(&answer->sessionKey, &sessionKey, sizeof(struct ktc_encryptionKey)); answer->startTime = htonl(times.start); answer->endTime = htonl(end); answer->kvno = server.key_version; @@ -1788,7 +1786,7 @@ static afs_int32 GetTicket (version, call, kvno, authDomain, aticket, putstr (sname); putstr (sinstance); if (rem < ticketLen) goto abort; - bcopy (ticket, ans, ticketLen); + memcpy(ans, ticket, ticketLen); oanswer->SeqLen = (ans - oanswer->SeqBody) + ticketLen; } oanswer->SeqLen = round_up_to_ebs(oanswer->SeqLen); @@ -1891,7 +1889,7 @@ afs_int32 kamGetStats (call, version, admin_accounts, statics, dynamics) } *admin_accounts = ntohl(cheader.admin_accounts); - /* bcopy ((char *)&cheader.stats, (char *)statics, sizeof(kasstats)); */ + /* memcpy((char *)statics, (char *)&cheader.stats, sizeof(kasstats)); */ /* these are stored in network byte order and must be copied */ statics->allocs = ntohl(cheader.stats.allocs); statics->frees = ntohl(cheader.stats.frees); @@ -1900,7 +1898,7 @@ afs_int32 kamGetStats (call, version, admin_accounts, statics, dynamics) check that the statistics command copies all the fields #endif - bcopy ((char *)&dynamic_statistics, (char *)dynamics, sizeof(kadstats)); + memcpy((char *)dynamics, (char *)&dynamic_statistics, sizeof(kadstats)); statics->minor_version = KAMINORVERSION; dynamics->minor_version = KAMINORVERSION; @@ -1921,8 +1919,8 @@ afs_int32 kamGetStats (call, version, admin_accounts, statics, dynamics) * ignore this for aix till v3.1... */ getrusage(RUSAGE_SELF, &ru); #if (KAMAJORVERSION>5) - bcopy (&ru.ru_utime, &dynamics->utime, sizeof(struct katimeval)); - bcopy (&ru.ru_stime, &dynamics->stime, sizeof(struct katimeval)); + memcpy(&dynamics->utime, &ru.ru_utime, sizeof(struct katimeval)); + memcpy(&dynamics->stime, &ru.ru_stime, sizeof(struct katimeval)); dynamics->dataSize = ru.ru_idrss; dynamics->stackSize = ru.ru_isrss; dynamics->pageFailts = ru.ru_majflt; @@ -1984,7 +1982,7 @@ afs_int32 kamGetPassword (call, name, password) return code; } - bcopy (&tentry.key, password, sizeof (*password)); + memcpy(password, &tentry.key, sizeof (*password)); code = ubik_EndTrans (tt); #endif return code; @@ -2038,7 +2036,7 @@ afs_int32 kamDebug (call, version, checkDB, info) if (sizeof(struct ka_cpwRequest) % 8) return KAINTERNALERROR; if (version != KAMAJORVERSION) return KAOLDINTERFACE; - bzero (info, sizeof(*info)); + memset(info, 0, sizeof(*info)); info->minorVersion = KAMINORVERSION; info->host = dynamic_statistics.host; diff --git a/src/kauth/kaserver.c b/src/kauth/kaserver.c index 68ac20c..cade640 100644 --- a/src/kauth/kaserver.c +++ b/src/kauth/kaserver.c @@ -82,7 +82,7 @@ afs_int32 es_Report(char *fmt, ...) static void initialize_dstats () { - bzero (&dynamic_statistics, sizeof(dynamic_statistics)); + memset(&dynamic_statistics, 0, sizeof(dynamic_statistics)); dynamic_statistics.start_time = time(0); dynamic_statistics.host = myHost; } @@ -102,7 +102,7 @@ static int convert_cell_to_ubik (cellinfo, myHost, serverList) ViceLog(0, ("kaserver: couldn't get address of this host.\n")); exit(1); } - bcopy(th->h_addr,myHost,sizeof(afs_int32)); + memcpy(myHost, th->h_addr, sizeof(afs_int32)); for (i=0; inumServers; i++) if (cellinfo->hostAddr[i].sin_addr.s_addr != *myHost) { diff --git a/src/kauth/kautils.c b/src/kauth/kautils.c index a2f431e..a240d93 100644 --- a/src/kauth/kautils.c +++ b/src/kauth/kautils.c @@ -142,11 +142,11 @@ afs_int32 ka_KeyCheckSum ( afs_int32 code; *cksumP = 0; - bzero (block, 8); + memset(block, 0, 8); code = des_key_sched (key, s); if (code) return KABADKEY; des_ecb_encrypt (block, block, s, ENCRYPT); - bcopy (block, &cksum, sizeof(afs_int32)); + memcpy(&cksum, block, sizeof(afs_int32)); *cksumP = ntohl(cksum); return 0; } diff --git a/src/kauth/kdb.c b/src/kauth/kdb.c index a83aa28..9009eaa 100644 --- a/src/kauth/kdb.c +++ b/src/kauth/kdb.c @@ -66,7 +66,7 @@ static cmdproc( fprintf(stderr, "%s: data came out corrupt\n", ti->data); continue; } - bcopy(data.dptr, &rdata, sizeof(kalog_elt)); + memcpy(&rdata, data.dptr, sizeof(kalog_elt)); printf("%s: last operation from host %x at %s", ti->data, rdata.host, ctime(&rdata.last_use)); } diff --git a/src/kauth/kkids.c b/src/kauth/kkids.c index 274d431..9339c34 100644 --- a/src/kauth/kkids.c +++ b/src/kauth/kkids.c @@ -95,7 +95,7 @@ static int simplify_name( * name (we know there is one) and splice in the symlink contents. */ if (true_name[0] != '/') { - last_component = (char *) rindex(orig_name, '/'); + last_component = (char *) strrchr(orig_name, '/'); strcpy(++last_component, true_name); strcpy(true_name, orig_name); } @@ -147,7 +147,7 @@ static int find_me( simplify_name(orig_name, truename); } else { - bp = (char *) rindex(arg, '/'); + bp = (char *) strrchr(arg, '/'); if (bp) { orig_name[0] = '.'; orig_name[1] = '/'; @@ -182,7 +182,7 @@ static int find_me( /* * Find rightmost slash, if any. */ - bp = (char *) rindex(truename, '/'); + bp = (char *) strrchr(truename, '/'); if (bp) { /* * Found it. Designate everything before it as the parent directory, diff --git a/src/kauth/klog.c b/src/kauth/klog.c index a89df2a..485c59a 100644 --- a/src/kauth/klog.c +++ b/src/kauth/klog.c @@ -135,7 +135,7 @@ static char *getpipepass(void) static char gpbuf[BUFSIZ]; /* read a password from stdin, stop on \n or eof */ register int i, tc; - bzero(gpbuf, sizeof(gpbuf)); + memset(gpbuf, 0, sizeof(gpbuf)); for(i=0; i<(sizeof(gpbuf)-1); i++) { tc = fgetc(stdin); if (tc == '\n' || tc == EOF) break; @@ -178,7 +178,7 @@ int CommandProc ( char *reason; /* string describing errors */ /* blow away command line arguments */ - for (i=1; iparms[aPASSWORD].items->data, sizeof(passwd)); - bzero (as->parms[aPASSWORD].items->data, - strlen(as->parms[aPASSWORD].items->data)); + memset(as->parms[aPASSWORD].items->data, 0, strlen(as->parms[aPASSWORD].items->data)); } if (as->parms[aLIFETIME].items) { @@ -345,7 +344,7 @@ bad_lifetime: code = ka_UserAuthenticateGeneral (KA_USERAUTH_VERSION + (dosetpag ? KA_USERAUTH_DOSETPAG2:0), pw->pw_name, instance, realm, passwd, lifetime, &password_expires, 0, &reason); - bzero (passwd, sizeof(passwd)); + memset(passwd, 0, sizeof(passwd)); if (code) { if (!Silent) { fprintf (stderr, diff --git a/src/kauth/klogin.c b/src/kauth/klogin.c index b940824..ff388e1 100644 --- a/src/kauth/klogin.c +++ b/src/kauth/klogin.c @@ -80,7 +80,7 @@ int timeout = 60; char term[64]; struct passwd *pwd; -char *strcat(), *rindex(), *index(), *malloc(), *realloc(); +char *strcat(), *malloc(), *realloc(); static void timedout(void); static void showmotd(void); static void doremoteterm(char *term, struct sgttyb *tp); @@ -152,7 +152,7 @@ int main( quota(Q_SETUID, 0, 0, 0); /* create a dummy user */ - bzero (&nouser, sizeof(nouser)); + memset(&nouser, 0, sizeof(nouser)); nouser.pw_name = ""; nouser.pw_passwd = "*"; nouser.pw_dir = nouser.pw_shell = ""; @@ -218,7 +218,7 @@ int main( ttyn = ttyname(0); if (ttyn == (char *)0 || *ttyn == '\0') ttyn = "/dev/tty??"; - tty = rindex(ttyn, '/'); + tty = strrchr(ttyn, '/'); if (tty == NULL) tty = ttyn; else @@ -426,7 +426,7 @@ int main( setenv("USER=", pwd->pw_name, 1); setenv("PATH=", ":/usr/ucb:/bin:/usr/bin", 0); - if ((namep = rindex(pwd->pw_shell, '/')) == NULL) + if ((namep = strrchr(pwd->pw_shell, '/')) == NULL) namep = pwd->pw_shell; else namep++; @@ -577,13 +577,13 @@ static void doremoteterm( char *term, struct sgttyb *tp) { - register char *cp = index(term, '/'), **cpp; + register char *cp = strchr(term, '/'), **cpp; char *speed; if (cp) { *cp++ = '\0'; speed = cp; - cp = index(speed, '/'); + cp = strchr(speed, '/'); if (cp) *cp++ = '\0'; for (cpp = speeds; cpp < &speeds[NSPEEDS]; cpp++) diff --git a/src/kauth/knfs.c b/src/kauth/knfs.c index dff7d57..e5dacc7 100644 --- a/src/kauth/knfs.c +++ b/src/kauth/knfs.c @@ -80,7 +80,7 @@ char *sysname; pheader[5] = 1; /* NFS protocol exporter # */ /* copy stuff in */ - bcopy(pheader, space, sizeof(pheader)); + memcpy(space, pheader, sizeof(pheader)); tp = space + sizeof(pheader); /* finally setup the pioctl call's parameters */ @@ -88,7 +88,7 @@ char *sysname; blob.in = space; blob.out_size = 0; blob.out = (char *) 0; - bcopy(&setp, tp, sizeof(afs_int32)); + memcpy(tp, &setp, sizeof(afs_int32)); tp += sizeof(afs_int32); strcpy(tp, sysname); blob.in_size += sizeof(afs_int32) + strlen(sysname) + 1; @@ -148,9 +148,9 @@ static GetTokens(ahost, auid) if (strcmp(clientName.name, "afs") != 0) continue; /* wrong ticket service */ /* copy stuff in */ - bcopy(pheader, tbuffer, sizeof(pheader)); + memcpy(tbuffer, pheader, sizeof(pheader)); tp = tbuffer + sizeof(pheader); - bcopy(&index, tp, sizeof(afs_int32)); + memcpy(tp, &index, sizeof(afs_int32)); tp += sizeof(afs_int32); iob.in = tbuffer; iob.in_size = sizeof(afs_int32) + sizeof(pheader); @@ -161,15 +161,15 @@ static GetTokens(ahost, auid) else if (code == 0) { /* check to see if this is the right cell/realm */ tp = tbuffer; - bcopy(tp, &temp, sizeof(afs_int32)); /* get size of secret token */ + memcpy(&temp, tp, sizeof(afs_int32)); /* get size of secret token */ tktLen = temp; /* remember size of ticket */ tp += sizeof(afs_int32); stp = tp; /* remember where ticket is, for later */ tp += temp; /* skip ticket for now */ - bcopy(tp, &temp, sizeof(afs_int32)); /* get size of clear token */ + memcpy(&temp, tp, sizeof(afs_int32)); /* get size of clear token */ if (temp != sizeof(struct ClearToken)) return KTC_ERROR; tp += sizeof(afs_int32); /* skip length */ - bcopy(tp, &ct, temp); /* copy token for later use */ + memcpy(&ct, tp, temp); /* copy token for later use */ tp += temp; /* skip clear token itself */ tp += sizeof(afs_int32); /* skip primary flag */ /* tp now points to the cell name */ @@ -178,12 +178,12 @@ static GetTokens(ahost, auid) gotit = 1; maxLen = sizeof(token) - sizeof(struct ktc_token) + MAXKTCTICKETLEN; if (maxLen < tktLen) return KTC_TOOBIG; - bcopy(stp, token.ticket, tktLen); + memcpy(token.ticket, stp, tktLen); token.startTime = ct.BeginTimestamp; token.endTime = ct.EndTimestamp; if (ct.AuthHandle == -1) ct.AuthHandle = 999; token.kvno = ct.AuthHandle; - bcopy(ct.HandShakeKey, &token.sessionKey, sizeof(struct ktc_encryptionKey)); + memcpy(&token.sessionKey, ct.HandShakeKey, sizeof(struct ktc_encryptionKey)); token.ticketLen = tktLen; if ((token.kvno == 999) || /* old style bcrypt ticket */ (ct.BeginTimestamp && /* new w/ prserver lookup */ @@ -249,7 +249,7 @@ afs_int32 auid; { pheader[5] = 1; /* NFS protocol exporter # */ /* copy stuff in */ - bcopy(pheader, space, sizeof(pheader)); + memcpy(space, pheader, sizeof(pheader)); /* finally setup the pioctl call's parameters */ blob.in_size = sizeof(pheader); @@ -300,30 +300,30 @@ afs_int32 auid; { pheader[5] = 1; /* NFS protocol exporter # */ /* copy in the header */ - bcopy(pheader, space, sizeof(pheader)); + memcpy(space, pheader, sizeof(pheader)); tp = space + sizeof(pheader); /* copy in the size of the encrypted part */ - bcopy(&theTicket.ticketLen, tp, sizeof(afs_int32)); + memcpy(tp, &theTicket.ticketLen, sizeof(afs_int32)); tp += sizeof(afs_int32); /* copy in the ticket itself */ - bcopy(theTicket.ticket, tp, theTicket.ticketLen); + memcpy(tp, theTicket.ticket, theTicket.ticketLen); tp += theTicket.ticketLen; /* copy in "clear token"'s size */ temp = sizeof(struct ClearToken); - bcopy(&temp, tp, sizeof(afs_int32)); + memcpy(tp, &temp, sizeof(afs_int32)); tp += sizeof(afs_int32); /* create the clear token and copy *it* in */ ct.AuthHandle = theTicket.kvno; /* where we hide the key version # */ - bcopy(&theTicket.sessionKey, ct.HandShakeKey, sizeof(ct.HandShakeKey)); + memcpy(ct.HandShakeKey, &theTicket.sessionKey, sizeof(ct.HandShakeKey)); ct.ViceId = auid; ct.BeginTimestamp = theTicket.startTime; ct.EndTimestamp = theTicket.endTime; - bcopy(&ct, tp, sizeof(ct)); + memcpy(tp, &ct, sizeof(ct)); tp += sizeof(ct); /* copy in obsolete primary flag */ temp = 0; - bcopy(&temp, tp, sizeof(afs_int32)); + memcpy(tp, &temp, sizeof(afs_int32)); tp += sizeof(afs_int32); /* copy in cell name, null terminated */ strcpy(tp, server.cell); @@ -357,7 +357,7 @@ afs_int32 arock; { printf("knfs: unknown host '%s'.\n", tp); return -1; } - bcopy(the->h_addr, &addr, sizeof(afs_int32)); + memcpy(&addr, the->h_addr, sizeof(afs_int32)); uid = -1; if (as->parms[1].items) { code = util_GetInt32(tp = as->parms[1].items->data, &uid); diff --git a/src/kauth/kpasswd.c b/src/kauth/kpasswd.c index 1e7cde8..0db876f 100644 --- a/src/kauth/kpasswd.c +++ b/src/kauth/kpasswd.c @@ -140,7 +140,7 @@ static void getpipepass(gpbuf, len) { /* read a password from stdin, stop on \n or eof */ register int i, tc; - bzero(gpbuf, len); + memset(gpbuf, 0, len); for(i=0;iparms[aPASSWORD].items->data, sizeof(passwd)); - bzero (as->parms[aPASSWORD].items->data, - strlen(as->parms[aPASSWORD].items->data)); + memset(as->parms[aPASSWORD].items->data, 0, strlen(as->parms[aPASSWORD].items->data)); } if (as->parms[aNEWPASSWORD].items) { @@ -344,8 +343,7 @@ CommandProc (as, arock) foundNewPassword = 1; strncpy (npasswd, as->parms[aNEWPASSWORD].items->data, sizeof(npasswd)); - bzero (as->parms[aNEWPASSWORD].items->data, - strlen(as->parms[aNEWPASSWORD].items->data)); + memset(as->parms[aNEWPASSWORD].items->data, 0, strlen(as->parms[aNEWPASSWORD].items->data)); } if (!foundExplicitCell) strcpy (realm, lcell); @@ -365,9 +363,9 @@ CommandProc (as, arock) code = read_pass (passwd, sizeof(passwd), "Old password: ", 0); if (code || (strlen (passwd) == 0)) { if (code) code = KAREADPW; - bzero (&mitkey, sizeof(mitkey)); - bzero (&key, sizeof(key)); - bzero (passwd, sizeof(passwd)); + memset(&mitkey, 0, sizeof(mitkey)); + memset(&key, 0, sizeof(key)); + memset(passwd, 0, sizeof(passwd)); if (code) com_err (rn, code, "reading password"); exit (1); } @@ -404,7 +402,7 @@ CommandProc (as, arock) printf ("Mismatch - "); goto no_change; } - bzero (verify, sizeof(verify)); + memset(verify, 0, sizeof(verify)); } } if (code = password_bad (npasswd)) { /* assmt here! */ @@ -423,7 +421,7 @@ CommandProc (as, arock) #endif ka_StringToKey (npasswd, realm, &newkey); des_string_to_key(npasswd, &newmitkey); - bzero (npasswd, sizeof(npasswd)); + memset(npasswd, 0, sizeof(npasswd)); if (lexplicit) ka_ExplicitCell (realm, serverList); @@ -448,8 +446,8 @@ CommandProc (as, arock) strncpy (pass8, passwd, 8); pass8[8] = 0; ka_StringToKey (pass8, realm, &key); - bzero (pass8, sizeof(pass8)); - bzero (passwd, sizeof(passwd)); + memset(pass8, 0, sizeof(pass8)); + memset(passwd, 0, sizeof(passwd)); code = ka_GetAdminToken (pw->pw_name, instance, realm, &key, ADMIN_LIFETIME, &token, /*!new*/0); #ifdef notdef @@ -471,8 +469,8 @@ CommandProc (as, arock) dess2k=0; } - bzero (&mitkey, sizeof(mitkey)); - bzero (&key, sizeof(key)); + memset(&mitkey, 0, sizeof(mitkey)); + memset(&key, 0, sizeof(key)); if (code == KAUBIKCALL) com_err (rn, code, "(Authentication Server unavailable, try later)"); else if (code) { if (code == KABADREQUEST) @@ -488,8 +486,8 @@ CommandProc (as, arock) code = ka_ChangePassword (pw->pw_name, instance, conn, 0, &newmitkey); else code = ka_ChangePassword (pw->pw_name, instance, conn, 0, &newkey); - bzero (&newkey, sizeof(newkey)); - bzero (&newmitkey, sizeof(newmitkey)); + memset(&newkey, 0, sizeof(newkey)); + memset(&newmitkey, 0, sizeof(newmitkey)); if (code) { char * reason; reason = (char *) error_message(code); @@ -498,8 +496,8 @@ CommandProc (as, arock) else printf("Password changed.\n\n"); } } - bzero (&newkey, sizeof(newkey)); - bzero (&newmitkey, sizeof(newmitkey)); + memset(&newkey, 0, sizeof(newkey)); + memset(&newmitkey, 0, sizeof(newmitkey)); /* Might need to close down the ubik_Client connection */ if (conn) { @@ -513,8 +511,8 @@ CommandProc (as, arock) no_change: /* yuck, yuck, yuck */ if (code) com_err (rn, code, "getting new password"); no_change_no_msg: - bzero (&key, sizeof(key)); - bzero (npasswd, sizeof(npasswd)); + memset(&key, 0, sizeof(key)); + memset(npasswd, 0, sizeof(npasswd)); printf("Password for '%s' in cell '%s' unchanged.\n\n", pw->pw_name, cell); terminate_child(); exit (code ? code : 1); diff --git a/src/kauth/krb_udp.c b/src/kauth/krb_udp.c index 05a2e58..2d13747 100644 --- a/src/kauth/krb_udp.c +++ b/src/kauth/krb_udp.c @@ -85,12 +85,12 @@ char udptgsServerPrincipal[256]; #define putstr(name) if ((slen = strlen(name)) >= MAXKTCNAMELEN) return -1;\ else strcpy (answer, name), answer += slen+1 #define putint(num) num = htonl(num), \ - bcopy (&num, answer, sizeof(afs_int32)), \ + memcpy(answer, &num, sizeof(afs_int32)), \ answer += sizeof(afs_int32) #define getstr(name) if ((slen = strlen(packet)) >= sizeof(name)) return -1;\ strcpy (name, packet), packet += slen+1 -#define getint(num) bcopy (packet, &num, sizeof(afs_int32)), \ +#define getint(num) memcpy(&num, packet, sizeof(afs_int32)), \ num = ktohl (byteOrder, num), \ packet += sizeof(afs_int32) @@ -139,7 +139,7 @@ static afs_int32 create_cipher (cipher, cipherLen, sessionKey, sname, sinst, if (ticketLen > 255) return KAANSWERTOOLONG; if (kvno > 255) return KAANSWERTOOLONG; - bcopy (sessionKey, answer, sizeof(*sessionKey)); + memcpy(answer, sessionKey, sizeof(*sessionKey)); answer += sizeof(*sessionKey); putstr (sname); putstr (sinst); @@ -147,7 +147,7 @@ static afs_int32 create_cipher (cipher, cipherLen, sessionKey, sname, sinst, *answer++ = life; *answer++ = (unsigned char) kvno; *answer++ = (unsigned char) ticketLen; - bcopy (ticket, answer, ticketLen); + memcpy(answer, ticket, ticketLen); answer += ticketLen; putint (start); @@ -201,10 +201,10 @@ static afs_int32 create_reply (ans, name, inst, startTime, endTime, kvno, *answer++ = (unsigned char) kvno; { short w = (short) cipherLen; w = htons(w); - bcopy (&w, answer, sizeof(short)); + memcpy(answer, &w, sizeof(short)); answer += sizeof(short); } - bcopy (cipher, answer, cipherLen); + memcpy(answer, cipher, cipherLen); return 0; } @@ -634,7 +634,7 @@ process_udp_auth (ksoc, pkt) "null realm name not allowed"); return; } - bcopy (packet, &startTime, sizeof(startTime)); + memcpy(&startTime, packet, sizeof(startTime)); packet += sizeof(startTime); startTime = ktohl (pkt->byteOrder, startTime); pkt->time = startTime; @@ -691,13 +691,13 @@ process_udp_appl (ksoc, pkt) err_packet (ksoc, pkt, KERB_ERR_TEXT_LENGTH, "ticket too long"); return; } - bcopy (packet, ticket, ticketLen); + memcpy(ticket, packet, ticketLen); packet += ticketLen; if (authLen > sizeof(auth)) { err_packet (ksoc, pkt, KERB_ERR_TEXT_LENGTH, "authenticator too long"); return; } - bcopy (packet, auth, authLen); + memcpy(auth, packet, authLen); pkt->rest = packet + authLen; code = UDP_GetTicket (ksoc, pkt, kvno, realm, ticket, ticketLen, auth, authLen); if (code) { @@ -826,7 +826,7 @@ afs_int32 init_krb_udp () if (inited) return -1; inited = 1; - bzero (&taddr, sizeof(taddr)); + memset(&taddr, 0, sizeof(taddr)); krb4name = "kerberos4"; sp = getservbyname(krb4name, "udp"); taddr.sin_family = AF_INET; /* added for NCR port */ diff --git a/src/kauth/manyklog.c b/src/kauth/manyklog.c index 7680f0d..10eb211 100644 --- a/src/kauth/manyklog.c +++ b/src/kauth/manyklog.c @@ -131,7 +131,7 @@ static char *getpipepass() { static char gpbuf[BUFSIZ]; /* read a password from stdin, stop on \n or eof */ register int i, tc; - bzero(gpbuf, sizeof(gpbuf)); + memset(gpbuf, 0, sizeof(gpbuf)); for(i=0; i<(sizeof(gpbuf)-1); i++) { tc = fgetc(stdin); if (tc == '\n' || tc == EOF) break; @@ -174,7 +174,7 @@ CommandProc (as, arock) char *reason; /* string describing errors */ /* blow away command line arguments */ - for (i=1; iparms[aPASSWORD].items->data, sizeof(passwd)); - bzero (as->parms[aPASSWORD].items->data, - strlen(as->parms[aPASSWORD].items->data)); + memset(as->parms[aPASSWORD].items->data, 0, strlen(as->parms[aPASSWORD].items->data)); } if (as->parms[aLIFETIME].items) { diff --git a/src/kauth/read_passwd.c b/src/kauth/read_passwd.c index 575588a..079d0f1 100644 --- a/src/kauth/read_passwd.c +++ b/src/kauth/read_passwd.c @@ -74,7 +74,7 @@ des_read_password(k,prompt,verify) string_to_key(key_string, k); lose: - bzero(key_string, sizeof (key_string)); + memset(key_string, 0, sizeof (key_string)); return ok; } @@ -137,7 +137,7 @@ read_pw_string(s,max,prompt,verify) } #ifdef BSDUNIX - bcopy(env, old_env, sizeof(env)); + memcpy(old_env, env, sizeof(env)); if (setjmp(env)) goto lose; @@ -204,14 +204,14 @@ read_pw_string(s,max,prompt,verify) lose: if (!ok) - bzero(s, max); + memset(s, 0, max); #ifdef BSDUNIX /* turn echo back on */ tty_state.sg_flags |= ECHO; if (ioctl(0,TIOCSETP,&tty_state)) ok = 0; pop_signals(); - bcopy(old_env, env, sizeof(env)); + memcpy(env, old_env, sizeof(env)); #else #if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) ttyb.c_lflag = flags; @@ -225,7 +225,7 @@ lose: #endif #endif if (verify) - bzero(key_string, sizeof (key_string)); + memset(key_string, 0, sizeof (key_string)); s[max-1] = 0; /* force termination */ return !ok; /* return nonzero if not okay */ } diff --git a/src/kauth/rebuild.c b/src/kauth/rebuild.c index c2a58cc..38432c5 100644 --- a/src/kauth/rebuild.c +++ b/src/kauth/rebuild.c @@ -414,7 +414,7 @@ WorkerBee (as, arock) nentries = (info.st_size-(UBIK_HEADERSIZE + header.headerSize)) / sizeof(struct kaentry); entrys = (int *)malloc(nentries * sizeof(int)); - bzero(entrys, nentries * sizeof(int)); + memset(entrys, 0, nentries * sizeof(int)); for (i=0, index=sizeof(header); iparms[aPASSWORD].items->data, sizeof(passwd)); - bzero (as->parms[aPASSWORD].items->data, - strlen(as->parms[aPASSWORD].items->data)); + memset(as->parms[aPASSWORD].items->data, 0, strlen(as->parms[aPASSWORD].items->data)); } if (as->parms[aLIFETIME].items) { @@ -318,7 +317,7 @@ bad_lifetime: } code = storecode; - bzero (passwd, sizeof(passwd)); + memset(passwd, 0, sizeof(passwd)); if (code) { if (!Silent) { fprintf (stderr, diff --git a/src/kauth/test/test_badtix.c b/src/kauth/test/test_badtix.c index 5a0e963..4742cce 100644 --- a/src/kauth/test/test_badtix.c +++ b/src/kauth/test/test_badtix.c @@ -327,7 +327,7 @@ int main (argc, argv) password[truncate[i]] = 0; ka_StringToKey (password, "andy.edu", &key); ka_ReadBytes (answer[i], &correct_key, sizeof(key)); - if (bcmp (&key, &correct_key, sizeof(key)) != 0) { + if (memcmp (&key, &correct_key, sizeof(key)) != 0) { printf ("String to key error converting '%s'; should be '%s' instead got '", password, answer[i]); ka_PrintBytes (&key, sizeof(key)); @@ -335,7 +335,7 @@ int main (argc, argv) exit (1); } } - bzero (password, sizeof(password)); + memset(password, 0, sizeof(password)); j=0; /* current password length */ for (i=(sizeof(truncate)/sizeof(int))-1; i>=0; i--) { while (jparms[13].items) { /* if password specified */ strncpy (passwd, as->parms[13].items->data, sizeof(passwd)); - bzero (as->parms[13].items->data, strlen (as->parms[13].items->data)); + memset(as->parms[13].items->data, 0, strlen (as->parms[13].items->data)); } else { char msg[sizeof(name)+15]; if (as->parms[12].items) strcpy (msg, "Admin Password: "); diff --git a/src/kauth/test/test_interim_ktc.c b/src/kauth/test/test_interim_ktc.c index 13af3e2..467dc8a 100644 --- a/src/kauth/test/test_interim_ktc.c +++ b/src/kauth/test/test_interim_ktc.c @@ -234,9 +234,9 @@ static int CheckAuth2 (server) /*Copy in the sizes and bodies of the secret and clear tokens*/ inbuff.sTokenSize = sizeof(EncryptedSecretToken); - bcopy(&sToken, (char *)&inbuff.stoken, sizeof(EncryptedSecretToken)); + memcpy((char *)&inbuff.stoken, &sToken, sizeof(EncryptedSecretToken)); inbuff.cTokenSize = sizeof(ClearToken); - bcopy(&cToken, (char*)&inbuff.ctoken, sizeof(ClearToken)); + memcpy((char*)&inbuff.ctoken, &cToken, sizeof(ClearToken)); /* Copy in the Primary ID flag and the cell name */ #if DB_CELLS @@ -271,8 +271,8 @@ static int CheckAuth2 (server) (token.startTime != 0) || (token.endTime != cToken.EndTimestamp) || (token.ticketLen != sizeof(sToken)) || - (bcmp (&cToken.HandShakeKey, &token.sessionKey, sizeof(struct ktc_encryptionKey)) != 0) || - (bcmp (&sToken, token.ticket, sizeof(sToken)) != 0)) { + (memcmp (&cToken.HandShakeKey, &token.sessionKey, sizeof(struct ktc_encryptionKey)) != 0) || + (memcmp (&sToken, token.ticket, sizeof(sToken)) != 0)) { fprintf (stdout, "Auth2 token was bad\n"); PrintAuthentication (stdout, server, &token, &client); return 1; @@ -302,7 +302,7 @@ static void ListCellsCmd () blob.in_size = sizeof(long); blob.in = space; blob.out = space; - bcopy(&i, space, sizeof(long)); + memcpy(space, &i, sizeof(long)); code = pioctl(0, VIOCGETCELL, &blob, 1); if (code < 0) { if (errno == EDOM) break; /* done with the list */ @@ -315,7 +315,7 @@ static void ListCellsCmd () if (verbose > 1) { printf("Cell %s on hosts", cellname); for (j=0; j < 8; j++) { - bcopy(space + j*sizeof(long), &clear, sizeof(long)); + memcpy(&clear, space + j*sizeof(long), sizeof(long)); if (clear == 0) break; #if SLOW tcp = hostutil_GetNameByINet(clear); @@ -820,7 +820,7 @@ main (argc, argv) /* First check for various pathological cases */ strcpy (server.cell, "foo.bar.baz"); - bcopy (&token, &ntoken, sizeof(ntoken)); + memcpy(&ntoken, &token, sizeof(ntoken)); code = ktc_SetToken (&server, &ntoken, &client, 0); if (code != KTC_NOCELL) { com_err (whoami, code, "should have gotten bad pioctl error calling SetToken with bogus cell name"); @@ -849,7 +849,7 @@ main (argc, argv) com_err (whoami, code, "calling SetToken with bogus client cell"); goto failed; } - bcopy (&token, &ntoken, sizeof(ntoken)); + memcpy(&ntoken, &token, sizeof(ntoken)); if (token.kvno == 999) ntoken.kvno = 99; /* Now check out SetToken parsing of specially formed names */ diff --git a/src/kauth/test/test_rxkad_free.c b/src/kauth/test/test_rxkad_free.c index 4f8c528..e99ea54 100644 --- a/src/kauth/test/test_rxkad_free.c +++ b/src/kauth/test/test_rxkad_free.c @@ -140,7 +140,7 @@ static long Main (as, arock) if (as->parms[13].items) { /* if password specified */ strncpy (passwd, as->parms[13].items->data, sizeof(passwd)); - bzero (as->parms[13].items->data, strlen (as->parms[13].items->data)); + memset(as->parms[13].items->data, 0, strlen (as->parms[13].items->data)); } else { char msg[sizeof(name)+15]; if (as->parms[12].items) strcpy (msg, "Admin Password: "); @@ -171,11 +171,11 @@ static long Main (as, arock) if (!doAuth) { ka_StringToKey (passwd, cell, &key); - bzero (passwd, sizeof(passwd)); + memset(passwd, 0, sizeof(passwd)); } if (hostUsage) { - bzero (serversUse, sizeof(serversUse)); - bzero (serversHost, sizeof(serversHost)); + memset(serversUse, 0, sizeof(serversUse)); + memset(serversHost, 0, sizeof(serversHost)); } startTime = time(0); diff --git a/src/kauth/user.c b/src/kauth/user.c index 792d8f4..ffd281d 100644 --- a/src/kauth/user.c +++ b/src/kauth/user.c @@ -71,7 +71,7 @@ afs_int32 GetTickets ( struct ktc_token token; code = ka_GetAuthToken (name, instance, realm, key, lifetime, pwexpires); - bzero (key, sizeof(*key)); + memset(key, 0, sizeof(*key)); if (code) return code; code = ka_GetAFSTicket (name, instance, realm, lifetime, flags); return code; @@ -238,7 +238,7 @@ afs_int32 ka_UserAuthenticateGeneral ( strncpy (pass8, password, 8); pass8[8] = 0; ka_StringToKey (pass8, realm, &key); - bzero (pass8, sizeof(pass8)); + memset(pass8, 0, sizeof(pass8)); code = GetTickets (name, instance, realm, &key, lifetime, password_expires, dosetpag); if (code == 0) { diff --git a/src/libacl/aclprocs.c b/src/libacl/aclprocs.c index b4376a2..3577344 100644 --- a/src/libacl/aclprocs.c +++ b/src/libacl/aclprocs.c @@ -38,10 +38,6 @@ pthread_mutex_t acl_list_mutex; static int AddToList(); static int GetFromList(); -#ifdef AFS_ALPHA_ENV -extern char *index(); -#endif - struct freeListEntry { struct freeListEntry *next; int size; @@ -177,7 +173,7 @@ char **elist; acl_NewExternalACL(acl->total, elist); nextc = *elist; lids.idlist_val = (afs_int32 *)malloc(ACL_MAXENTRIES *sizeof(afs_int32)); - bzero(lids.idlist_val, ACL_MAXENTRIES * sizeof(afs_int32)); + memset(lids.idlist_val, 0, ACL_MAXENTRIES * sizeof(afs_int32)); lids.idlist_len = acl->total; lnames.namelist_len = 0; lnames.namelist_val = (prname *)0; @@ -252,14 +248,14 @@ struct acl_accessList **acl; if (sscanf(nextc, "%s\t%d\n", lnames.namelist_val[i], &k) != 2) return(-1); (*acl)->entries[i].rights = k; - nextc = (char *) (index(nextc, '\n')); + nextc = (strchr(nextc, '\n')); nextc ++; /* 1 + index can cast ptr to integer */ } j=i; for (i = (*acl)->total - 1; i >= (*acl)->total - (*acl)->negative; i--,j++) { if (sscanf(nextc, "%s\t%d\n", lnames.namelist_val[j], &((*acl)->entries[j].rights)) != 2) return(-1); - nextc = (char *) (index(nextc, '\n')); + nextc = (strchr(nextc, '\n')); nextc ++; } lids.idlist_len = 0; diff --git a/src/libadmin/client/afs_clientAdmin.c b/src/libadmin/client/afs_clientAdmin.c index becfd15..cf0b3ef 100644 --- a/src/libadmin/client/afs_clientAdmin.c +++ b/src/libadmin/client/afs_clientAdmin.c @@ -1260,7 +1260,7 @@ static int Parent( int rc = 0; strcpy(parentDirectory, directory); - tp = rindex(parentDirectory, '/'); + tp = strrchr(parentDirectory, '/'); if (tp) { *tp = 0; rc = 1; diff --git a/src/libadmin/test/bos.c b/src/libadmin/test/bos.c index 09ce30b..8b5ad5d 100644 --- a/src/libadmin/test/bos.c +++ b/src/libadmin/test/bos.c @@ -203,7 +203,7 @@ int ktime_ParsePeriodic( register afs_int32 code; struct ptemp *tp; - bzero(ak, sizeof(*ak)); + memset(ak, 0, sizeof(*ak)); code = LocalParseLine(adate, &tt); if (code) return -1; for(;tt;tt=tt->next) { diff --git a/src/libadmin/vos/vosutils.c b/src/libadmin/vos/vosutils.c index 1ee1a2a..3a8b45f 100644 --- a/src/libadmin/vos/vosutils.c +++ b/src/libadmin/vos/vosutils.c @@ -45,7 +45,7 @@ static int OldVLDB_to_NewVLDB( int rc = 0; afs_status_t tst = 0; - bzero(dest, sizeof(struct nvldbentry)); + memset(dest, 0, sizeof(struct nvldbentry)); strncpy(dest->name, source->name, sizeof(dest->name)); for (i = 0; i < source->nServers; i++) { dest->serverNumber[i] = source->serverNumber[i]; @@ -81,7 +81,7 @@ static int NewVLDB_to_OldVLDB( afs_status_t tst = 0; int rc = 0; - bzero(dest, sizeof(struct vldbentry)); + memset(dest, 0, sizeof(struct vldbentry)); strncpy(dest->name, source->name, sizeof(dest->name)); if (source->nServers <= OMAXNSERVERS) { for (i = 0; i < source->nServers; i++) { @@ -358,11 +358,11 @@ int VLDB_IsSameAddrs( goto fail_VLDB_IsSameAddrs; } - bzero(&attrs, sizeof(attrs)); + memset(&attrs, 0, sizeof(attrs)); attrs.Mask = VLADDR_IPADDR; attrs.ipaddr = serv1; - bzero(&addrs, sizeof(addrs)); - bzero(&uuid, sizeof(uuid)); + memset(&addrs, 0, sizeof(addrs)); + memset(&uuid, 0, sizeof(uuid)); tst = ubik_Call(VL_GetAddrsU, cellHandle->vos, 0, &attrs, &uuid, &unique, &nentries, &addrs); if (tst) { diff --git a/src/libadmin/vos/vsprocs.c b/src/libadmin/vos/vsprocs.c index d7e8612..1abd0f2 100644 --- a/src/libadmin/vos/vsprocs.c +++ b/src/libadmin/vos/vsprocs.c @@ -1468,8 +1468,8 @@ int UV_ReleaseVolume( int releasecount = 0; struct volser_status volstatus; - bzero((char *)remembertime, sizeof(remembertime)); - bzero((char *)&results, sizeof(results)); + memset((char *)remembertime, 0, sizeof(remembertime)); + memset((char *)&results, 0, sizeof(results)); tst = ubik_Call(VL_SetLock, cellHandle->vos, 0, afromvol, RWVOL, VLOP_RELEASE); if ((tst) && (tst != VL_RERELEASE)) { @@ -1675,7 +1675,7 @@ int UV_ReleaseVolume( strcpy(vname, entry.name); strcat(vname, ".readonly"); - bzero(&cookie,sizeof(cookie)); + memset(&cookie, 0, sizeof(cookie)); strncpy(cookie.name, vname, VOLSER_OLDMAXVOLNAME); cookie.type = ROVOL; cookie.parent = entry.volumeId[RWVOL]; @@ -1691,10 +1691,10 @@ int UV_ReleaseVolume( goto fail_UV_ReleaseVolume; } - bzero (replicas, (sizeof(struct replica)*nservers+1)); - bzero (times, (sizeof(struct release)*nservers+1)); - bzero (toconns, (sizeof(struct rx_connection *)*nservers+1)); - bzero (results.manyResults_val, (sizeof(afs_int32)*nservers+1)); + memset(replicas, 0, (sizeof(struct replica)*nservers+1)); + memset(times, 0, (sizeof(struct release)*nservers+1)); + memset(toconns, 0, (sizeof(struct rx_connection *)*nservers+1)); + memset(results.manyResults_val, 0, (sizeof(afs_int32)*nservers+1)); /* Create a transaction on the cloned volume */ tst = AFSVolTransCreate(fromconn, cloneVolId, afrompart, ITBusy, &fromtid); @@ -2249,7 +2249,7 @@ int UV_RestoreVolume( int index, same; - bzero(&cookie,sizeof(cookie)); + memset(&cookie, 0, sizeof(cookie)); islocked = 0; success = 0; error = 0; @@ -2922,7 +2922,7 @@ static afs_int32 ProcessEntries( } else if(tst && (tst == VL_NOENT)) { /*entry doesnot exist */ /*set up a vldb entry for elem */ - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); strncpy(entry.name,elem.name,VOLSER_OLDMAXVOLNAME); if(elem.isValid[RWVOL]) { /*rw exists */ entry.flags |= RW_EXISTS; @@ -3512,7 +3512,7 @@ int UV_SyncServer( for(si = 0;si != -1; si=nsi) { /*initialize to hint the stub to alloc space */ - bzero(&arrayEntries, sizeof(arrayEntries)); + memset(&arrayEntries, 0, sizeof(arrayEntries)); if (!VLDB_ListAttributes(cellHandle, &attributes, &nentries, &arrayEntries, &tst)) { goto fail_UV_SyncServer; diff --git a/src/log/kseal.c b/src/log/kseal.c index 98f20b6..6b25ba5 100644 --- a/src/log/kseal.c +++ b/src/log/kseal.c @@ -74,8 +74,8 @@ char **argv; { string_to_key(argv[2], skey); now = time(0); - bcopy(&now, session, 4); /* but this is only a test pgm */ - bcopy(&now, session+4, 4); + memcpy(session, &now, 4); /* but this is only a test pgm */ + memcpy(session+4, &now, 4); code = tkt_MakeTicket(token.ticket, &token.ticketLen, skey, argv[1], "", cellName, now-300, now+25*3600, session, /* host */ 0, "afs", ""); if (code) { @@ -89,7 +89,7 @@ char **argv; { strcpy(sname.cell, cellName); token.startTime = 0; token.endTime = 0x7fffffff; - bcopy(session, &token.sessionKey, 8); + memcpy(&token.sessionKey, session, 8); token.kvno = 0; code = ktc_SetToken (&sname, &token, (char *) 0, 0); if (code) { diff --git a/src/log/test/testlog.c b/src/log/test/testlog.c index cb9e48c..7acd441 100644 --- a/src/log/test/testlog.c +++ b/src/log/test/testlog.c @@ -193,7 +193,7 @@ main (argc, argv) */ foundPassword = TRUE; strcpy(passwd, argv[currArg]); - bzero(argv[currArg], strlen(passwd)); + memset(argv[currArg], 0, strlen(passwd)); currArg++; #if DB_ARGPARSE fprintf(stderr, "Found password: '%s' (%d chars), erased from arg list (now '%s').\n", diff --git a/src/login/login.c b/src/login/login.c index 4202c1b..e033802 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -747,7 +747,7 @@ doafs: (void)signal(SIGTSTP, SIG_IGN); tbuf[0] = '-'; - (void)strcpy(tbuf + 1, (p = rindex(shell, '/')) ? p + 1 : shell); + (void)strcpy(tbuf + 1, (p = strrchr(shell, '/')) ? p + 1 : shell); sia_ses_release(&entity); execlp(shell, tbuf, 0); (void)printf("login: no shell: %s.\n", strerror(errno)); @@ -2040,7 +2040,7 @@ static char *getlinep(const char *string, int size, FILE *stream) { if(!fgets(string, size, stream) || ferror(stream) || errno == EINTR) return NULL; else - if(cp=index(string, '\n')) + if(cp=strchr(string, '\n')) *cp = '\0'; else while((c=getc(stdin)) != '\n' && c != EOF && errno != EINTR) diff --git a/src/login/setenv.c b/src/login/setenv.c index df06213..614c867 100644 --- a/src/login/setenv.c +++ b/src/login/setenv.c @@ -68,7 +68,7 @@ setenv(name, value, rewrite) (cnt + 2))); if (!P) return(-1); - bcopy(environ, P, cnt * sizeof(char *)); + memcpy(P, environ, cnt * sizeof(char *)); environ = P; } environ[cnt + 1] = NULL; diff --git a/src/login/util_logout.c b/src/login/util_logout.c index 046c5a2..161b71d 100644 --- a/src/login/util_logout.c +++ b/src/login/util_logout.c @@ -54,9 +54,9 @@ logout(line) if (!ut.ut_name[0] || strncmp(ut.ut_line, line, sizeof(ut.ut_line))) continue; - bzero(ut.ut_name, sizeof(ut.ut_name)); + memset(ut.ut_name, 0, sizeof(ut.ut_name)); #if !defined(AIX) && !defined(AFS_SUN5_ENV) - bzero(ut.ut_host, sizeof(ut.ut_host)); + memset(ut.ut_host, 0, sizeof(ut.ut_host)); #endif /* AIX */ (void)time(&ut.ut_time); (void)fseek(fp, (long)-sizeof(struct utmp), L_INCR); diff --git a/src/lwp/iomgr.c b/src/lwp/iomgr.c index 9f8d4f7..f5d176b 100644 --- a/src/lwp/iomgr.c +++ b/src/lwp/iomgr.c @@ -244,7 +244,7 @@ static struct IoRequest *NewRequest() #else #define FDS_P_POS (sizeof(int)*8) #define INTS_PER_FDS(x) (((x)+(FDS_P_POS-1)) / FDS_P_POS) -#define FD_N_ZERO(nfds, x) bzero((char*)(x), (INTS_PER_FDS(nfds))*sizeof(int)) +#define FD_N_ZERO(nfds, x) memset((char*)(x), 0, (INTS_PER_FDS(nfds))*sizeof(int)) #endif #if defined(AFS_LINUX22_ENV) && (__GLIBC_MINOR__ > 0) diff --git a/src/lwp/lwp.c b/src/lwp/lwp.c index 4ca189f..3e438e8 100644 --- a/src/lwp/lwp.c +++ b/src/lwp/lwp.c @@ -1252,7 +1252,7 @@ static PROCESS lwp_alloc_process(name, ep, arg) { PROCESS lp; assert(lp = (PROCESS) malloc(sizeof (*lp))); - bzero((char *) lp, sizeof(*lp)); + memset((char *) lp, 0, sizeof(*lp)); if (!name) { char temp[100]; static procnum; diff --git a/src/lwp/preempt.c b/src/lwp/preempt.c index b45ddd3..e678eed 100644 --- a/src/lwp/preempt.c +++ b/src/lwp/preempt.c @@ -67,7 +67,7 @@ int PRE_InitPreempt(slice) itv.it_interval = itv.it_value = *slice; } - bzero((char *)&action, sizeof(action)); + memset((char *)&action, 0, sizeof(action)); action.sa_sigaction = AlarmHandler; action.sa_flags = SA_SIGINFO; @@ -87,7 +87,7 @@ int PRE_EndPreempt() itv.it_value.tv_sec = itv.it_value.tv_usec = 0; - bzero((char *)&action, sizeof(action)); + memset((char *)&action, 0, sizeof(action)); action.sa_handler = SIG_DFL; if ((setitimer(ITIMER_REAL, &itv, (struct itimerval *) 0) == -1) || diff --git a/src/lwp/test/selsubs.c b/src/lwp/test/selsubs.c index 732b601..d30a9de 100644 --- a/src/lwp/test/selsubs.c +++ b/src/lwp/test/selsubs.c @@ -39,7 +39,7 @@ RCSID("$Header$"); fd_set *IOMGR_AllocFDSet(void) { fd_set *tmp = (fd_set*)malloc(sizeof(fd_set)); - bzero((char*)tmp, sizeof(fd_set)); + memset((char*)tmp, 0, sizeof(fd_set)); return tmp; } diff --git a/src/lwp/test/testlwp.c b/src/lwp/test/testlwp.c index 71aebc0..6a8eae3 100644 --- a/src/lwp/test/testlwp.c +++ b/src/lwp/test/testlwp.c @@ -376,7 +376,7 @@ int LWP_MwaitProcess(wcount, evlist, ecount) /* wait on m of n events */ if (ecount == 1) lwp_cpptr->eventlist[0] = evlist[0]; else - bcopy(evlist, lwp_cpptr->eventlist, ecount*sizeof(char *)); + memcpy(lwp_cpptr->eventlist, evlist, ecount*sizeof(char *)); if (wcount > 0) { lwp_cpptr -> status = WAITING; move(lwp_cpptr, &runnable[lwp_cpptr->priority], &blocked); diff --git a/src/mpp/mpp.c b/src/mpp/mpp.c index 34fd10b..b2bdc3f 100644 --- a/src/mpp/mpp.c +++ b/src/mpp/mpp.c @@ -4,7 +4,6 @@ #include extern char *malloc(); -extern char *rindex(); #define maxinputdepth 16 #define maxlinesize 1024 @@ -215,7 +214,7 @@ static directive(what) if (*what++ != specialchar) return nestp->status; - if (cp = rindex(what,'\n')) + if (cp = strrchr(what, '\n')) *cp = 0; for (n = 0; n < 2; n++) { @@ -382,7 +381,7 @@ main( argc, argv ) char *cp, *cp2; cp = &argv[0][sizeof("-D")-1]; - if (cp2 = rindex(cp,'=')) + if (cp2 = strrchr(cp, '=')) *cp2++ = 0; if (cp2 == 0) cp2 = ""; diff --git a/src/ntp/mkntpconf.c b/src/ntp/mkntpconf.c index 5ad8032..1386316 100644 --- a/src/ntp/mkntpconf.c +++ b/src/ntp/mkntpconf.c @@ -97,7 +97,7 @@ main(ac, av) name = (ac > 0) ? (ac--, *av++) : (ac = 0, "mkntpconf"); (void) strcpy(tempfn, name); - if ((p = rindex(tempfn, '/')) == 0) + if ((p = strrchr(tempfn, '/')) == 0) p = tempfn; else p += 1; @@ -137,7 +137,7 @@ main(ac, av) peerline(guava, f); peerline(cluster1, f); } else { - if ((p = index(hostname, '.')) != 0 + if ((p = strchr(hostname, '.')) != 0 && strcmp(p+1, "srv.cs.cmu.edu") == 0) { peerline(papaya, f); peerline(guava, f); @@ -146,12 +146,12 @@ main(ac, av) serv.s_addr = 0; if ((g = fopen("/etc/attributes", "r")) != NULL) { while (fgets(line, sizeof(line), g) != NULL) { - if ((p = index(line, ':')) != 0) + if ((p = strchr(line, ':')) != 0) *p = 0; if (strcmp(line, papaya.s_name) == 0 || strcmp(line, guava.s_name) == 0) continue; - if ((p = index(line, '.')) == 0 + if ((p = strchr(line, '.')) == 0 || strcmp(p+1, "srv.cs.cmu.edu") != 0) continue; peerline(serv, f); diff --git a/src/ntp/ntp.c b/src/ntp/ntp.c index bc2f88c..a3c4f63 100644 --- a/src/ntp/ntp.c +++ b/src/ntp/ntp.c @@ -160,10 +160,10 @@ main(argc, argv) argv[host]); continue; } - bcopy(hp->h_addr, (char *) &dst.sin_addr,hp->h_length); + memcpy((char *) &dst.sin_addr, hp->h_addr, hp->h_length); } - bzero((char *)pkt, sizeof(ntp_data)); + memset((char *)pkt, 0, sizeof(ntp_data)); pkt->status = NTPVERSION_1 | NO_WARNING | MODE_CLIENT; pkt->stratum = UNSPECIFIED; diff --git a/src/ntp/ntp.h b/src/ntp/ntp.h index 72fbf11..423c848 100644 --- a/src/ntp/ntp.h +++ b/src/ntp/ntp.h @@ -13,7 +13,7 @@ #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) -#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) +#define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p))) #endif #ifndef NBBY diff --git a/src/ntp/ntp_adjust.c b/src/ntp/ntp_adjust.c index 911ce46..3cacaa1 100644 --- a/src/ntp/ntp_adjust.c +++ b/src/ntp/ntp_adjust.c @@ -287,7 +287,7 @@ ZeroAIXcum() if (debug > 6) printf ("Zeroing aix_adjtime accumulation: %d %d\n", cum.tv_sec, cum.tv_usec); - bzero (&cum, sizeof(cum)); + memset(&cum, 0, sizeof(cum)); } int adjtime(newdelta, olddelta) diff --git a/src/ntp/ntpd.c b/src/ntp/ntpd.c index 3f56681..5ecad2b 100644 --- a/src/ntp/ntpd.c +++ b/src/ntp/ntpd.c @@ -753,7 +753,7 @@ init_ntp(config) double j; extern double drift_comp; - bzero((char *) &sin, sizeof(sin)); + memset((char *) &sin, 0, sizeof(sin)); fp = fopen(config, "r"); if (fp == NULL) { fprintf(stderr,"Problem opening NTP initialization file %s\n", @@ -1296,8 +1296,7 @@ GetHostName(name, sin) if (hp = gethostbyname(name)) { if (hp->h_addrtype != AF_INET) return (0); - bcopy((char *) hp->h_addr, (char *) &sin->sin_addr, - hp->h_length); + memcpy((char *) &sin->sin_addr, (char *) hp->h_addr, hp->h_length); sin->sin_family = hp->h_addrtype; return (1); } diff --git a/src/ntp/ntpdc.c b/src/ntp/ntpdc.c index 41e626c..e3c0589 100644 --- a/src/ntp/ntpdc.c +++ b/src/ntp/ntpdc.c @@ -76,7 +76,7 @@ main(argc, argv) sigaction(SIGSEGV, &nsa, NULL); #endif (void) gethostname(LocalHostName, sizeof LocalHostName); - if (p = index(LocalHostName, '.')) { + if (p = strchr(LocalHostName, '.')) { *p++ = '\0'; LocalDomain = p; } @@ -213,7 +213,7 @@ query(host) static struct servent *sp = NULL; afs_int32 HostAddr; - bzero((char *) &watcher, sizeof(watcher)); + memset((char *) &watcher, 0, sizeof(watcher)); watcher.sin_family = AF_INET; HostAddr = inet_addr(host); watcher.sin_addr.s_addr = (afs_uint32) HostAddr; @@ -223,7 +223,7 @@ query(host) fprintf(stderr,"%s: unknown\n", host); return 0; } - bcopy(hp->h_addr, (char *) &watcher.sin_addr, hp->h_length); + memcpy((char *) &watcher.sin_addr, hp->h_addr, hp->h_length); } sp = getservbyname("ntp", "udp"); if (sp == 0) { @@ -363,7 +363,7 @@ cvthname(f) if (hp == 0) return (inet_ntoa(f->sin_addr)); - if ((p = index(hp->h_name, '.')) && strcmp(p + 1, LocalDomain) == 0) + if ((p = strchr(hp->h_name, '.')) && strcmp(p + 1, LocalDomain) == 0) *p = '\0'; return (hp->h_name); } diff --git a/src/ntp/read_psti.c b/src/ntp/read_psti.c index 6a85b10..fd8ff82 100644 --- a/src/ntp/read_psti.c +++ b/src/ntp/read_psti.c @@ -126,12 +126,12 @@ char *timesource; tty.c_iflag = ICRNL; tty.c_oflag = 0; tty.c_lflag = 0; - bzero((char *)tty.c_cc, sizeof tty.c_cc); + memset((char *)tty.c_cc, 0, sizeof tty.c_cc); tty.c_cc[VMIN] = MIN_READ; tty.c_cc[VTIME] = 0; if (ioctl(cfd, TCSETA, &tty) < 0) { #else /* TCSETA Use older Berkeley style IOCTL's */ - bzero((char *)&tty, sizeof tty); + memset((char *)&tty, 0, sizeof tty); tty.sg_ispeed = tty.sg_ospeed = B9600; tty.sg_flags = ANYP|CRMOD; tty.sg_erase = tty.sg_kill = '\0'; diff --git a/src/ntp/runntp.c b/src/ntp/runntp.c index b255206..0114e08 100644 --- a/src/ntp/runntp.c +++ b/src/ntp/runntp.c @@ -212,7 +212,7 @@ main (argc, argv) /* handle bozo kills right */ { struct sigaction sa; - bzero((char *)&sa, sizeof(sa)); + memset((char *)&sa, 0, sizeof(sa)); sa.sa_handler = terminate; code = sigaction (SIGTERM, &sa, NULL); if (code) { diff --git a/src/ntp/test.c b/src/ntp/test.c index a628bfd..623fdc3 100644 --- a/src/ntp/test.c +++ b/src/ntp/test.c @@ -198,8 +198,8 @@ test5(v) struct sysdata sys; double delay; - bzero (&peer, sizeof(peer)); - bzero (&sys, sizeof(sys)); + memset(&peer, 0, sizeof(peer)); + memset(&sys, 0, sizeof(sys)); pkt.precision = -6; peer.precision = pkt.precision; sys.precision = pkt.precision; diff --git a/src/package/check.c b/src/package/check.c index bc774cc..068f7f0 100644 --- a/src/package/check.c +++ b/src/package/check.c @@ -26,7 +26,6 @@ char *emalloc(); char *strcpy(); -char *rindex(); CTREEPTR LocateChildNode(); static char path2[MAXPATHLEN+1]; /* $$get rid of this */ @@ -71,7 +70,7 @@ static CheckMount(path) * Copy out the candidate mountpoint's pathname into dir, throwing * off any leaf component from the original path. */ - ep = rindex(path, '/'); + ep = strrchr(path, '/'); for (sp = path, dp = dir; sp < ep; *dp++ = *sp++); if (dp == dir) *dp++ = '/'; @@ -80,7 +79,7 @@ static CheckMount(path) /* * Copy out the parent's pathname into parent. */ - ep = rindex(dir, '/'); + ep = strrchr(dir, '/'); for (sp = dir, dp = parent; sp < ep; *dp++ = *sp++); if (dp == parent) *dp++ = '/'; diff --git a/src/package/conftree.c b/src/package/conftree.c index c0056c7..9e82583 100644 --- a/src/package/conftree.c +++ b/src/package/conftree.c @@ -93,7 +93,7 @@ static CTREEPTR AllocConfigNode() register CTREEPTR np; np = (CTREEPTR) emalloc(sizeof(CTREE)); - bzero((char *)np, sizeof(CTREE)); + memset((char *)np, 0, sizeof(CTREE)); return(np); } /*AllocConfigNode*/ diff --git a/src/pinstall/install.c b/src/pinstall/install.c index 1eccdf5..bfa7eac 100644 --- a/src/pinstall/install.c +++ b/src/pinstall/install.c @@ -94,10 +94,6 @@ extern struct passwd *getpwnam(); int stripcalled = 0; #endif -#ifndef rindex -extern char *rindex(); /* this should always be defined, shouldn't it? */ -#endif - #if defined(AFS_HPUX_ENV) && !defined(AFS_HPUX102_ENV) utimes(file,tvp) char *file; @@ -118,7 +114,7 @@ static char *strrpbrk (s, set) char sets[256]; int i; - bzero (sets, sizeof(sets)); + memset(sets, 0, sizeof(sets)); while (*set) sets[(int) *set++] = 1; i = strlen (s); while (i > 0) if (sets[(int)s[--i]]) return &s[i]; @@ -139,7 +135,7 @@ char *ErrorString(aerrno) int stripName(aname) char *aname; - {if (rindex(aname, '.') == 0) return 1; + {if (strrchr(aname, '.') == 0) return 1; else return 0; } @@ -642,7 +638,7 @@ main (argc, argv) for (i=0;i misc->maxForId) misc->maxForId = id; } else { @@ -613,7 +613,7 @@ afs_int32 WalkChains (map, misc) if (code) return code; code = WalkNextChain (map, misc, ea, &e); if (code) return code; - if (index(e.name,'@') == 0) { + if (strchr(e.name,'@') == 0) { misc->nusers++; /* Not a foreign user */ } else { misc->nforeigns++; /* A foreign user */ @@ -724,7 +724,7 @@ afs_int32 DumpRecreate (map, misc) rc = misc->recreate; idmap = misc->idmap; - bzero (idmap, misc->idRange*sizeof(misc->idmap[0])); + memset(idmap, 0, misc->idRange*sizeof(misc->idmap[0])); do { found = 0; for (ei=createLow; einEntries; ei++) { @@ -927,7 +927,7 @@ afs_int32 CheckPrDatabase (misc) if (misc->verbose) printf ("Database has %d entries\n", n); map = (char *)malloc (n); - bzero (map, n); + memset(map, 0, n); misc->nEntries = n; if (misc->verbose) { @@ -959,7 +959,7 @@ afs_int32 CheckPrDatabase (misc) code = -1; goto abort; } - bzero (misc->idmap, misc->idRange*sizeof(misc->idmap[0])); + memset(misc->idmap, 0, misc->idRange*sizeof(misc->idmap[0])); if (misc->verbose) { printf ("\nChecking entry chains\n"); @@ -1052,7 +1052,7 @@ WorkerBee (as, arock) initialize_u_error_table(); pr_dbaseName = AFSDIR_SERVER_PRDB_FILEPATH; - bzero (&misc, sizeof(misc)); + memset(&misc, 0, sizeof(misc)); pr_dbaseName = as->parms[0].items->data; /* -database */ misc.listuheader = (as->parms[1].items ? 1 : 0); /* -uheader */ diff --git a/src/ptserver/ptclient.c b/src/ptserver/ptclient.c index 73f7043..e05639e 100644 --- a/src/ptserver/ptclient.c +++ b/src/ptserver/ptclient.c @@ -284,7 +284,7 @@ char **argv; else printf("location %d\n",pos); } else if (!strcmp(op,"du")) { - bzero(&entry,sizeof(entry)); + memset(&entry, 0, sizeof(entry)); /* scanf("%d",&pos); */ if (GetInt32 (&pos)) code = PRBADARG; else code = ubik_Call(PR_DumpEntry, pruclient, 0, pos, &entry); @@ -458,7 +458,7 @@ char **argv; else if (!strcmp(op,"fih")) { char tname[128]; struct PrUpdateEntry uentry; - bzero(&uentry, sizeof(uentry)); + memset(&uentry, 0, sizeof(uentry)); /* scanf("%s",name); */ if (GetString (name, sizeof(name))) { code = PRBADARG; @@ -484,7 +484,7 @@ char **argv; else if (!strcmp(op,"fnh")) { int tid; struct PrUpdateEntry uentry; - bzero(&uentry, sizeof(uentry)); + memset(&uentry, 0, sizeof(uentry)); /* scanf("%d", &id); */ if (GetInt32 (&id)) { code = PRBADARG; diff --git a/src/ptserver/ptprocs.c b/src/ptserver/ptprocs.c index 5b85b3f..ae5bdc7 100644 --- a/src/ptserver/ptprocs.c +++ b/src/ptserver/ptprocs.c @@ -410,7 +410,7 @@ afs_int32 gid; if (code) ABORT_WITH(tt,PRPERM); tempu = FindByID(tt,aid); if (!tempu) ABORT_WITH(tt,PRNOENT); - bzero(&uentry,sizeof(uentry)); + memset(&uentry, 0, sizeof(uentry)); code = pr_ReadEntry(tt,0,tempu,&uentry); if (code != 0) ABORT_WITH(tt,code); /* we don't allow groups as members of groups at present */ @@ -790,8 +790,8 @@ afs_int32 gid; if (!tempu) ABORT_WITH(tt,PRNOENT); tempg = FindByID(tt,gid); if (!tempg) ABORT_WITH(tt,PRNOENT); - bzero(&uentry,sizeof(uentry)); - bzero(&gentry,sizeof(gentry)); + memset(&uentry, 0, sizeof(uentry)); + memset(&gentry, 0, sizeof(gentry)); code = pr_ReadEntry(tt,0,tempu,&uentry); if (code != 0) ABORT_WITH(tt,code); code = pr_ReadEntry(tt,0,tempg,&gentry); @@ -1164,7 +1164,7 @@ struct prcheckentry *aentry; aentry->ngroups = tentry.ngroups; aentry->nusers = tentry.nusers; aentry->count = tentry.count; - bzero (aentry->reserved, sizeof(aentry->reserved)); + memset(aentry->reserved, 0, sizeof(aentry->reserved)); code = ubik_EndTrans(tt); if (code) return code; return PRSUCCESS; @@ -1292,7 +1292,7 @@ afs_int32 put_prentries(tentry, bulkentries) entry->nusers = tentry->nusers; entry->count = tentry->count; strncpy(entry->name,tentry->name,PR_MAXNAMELEN); - bzero(entry->reserved, sizeof(entry->reserved)); + memset(entry->reserved, 0, sizeof(entry->reserved)); bulkentries->prentries_len++; return 0; } diff --git a/src/ptserver/ptserver.c b/src/ptserver/ptserver.c index b25a773..bbf5785 100644 --- a/src/ptserver/ptserver.c +++ b/src/ptserver/ptserver.c @@ -206,7 +206,7 @@ void main (argc, argv) fprintf (stderr, "ptserver: couldn't get address of this host.\n"); PT_EXIT(1); } - bcopy(th->h_addr,&myHost,sizeof(afs_int32)); + memcpy(&myHost, th->h_addr, sizeof(afs_int32)); /* get list of servers */ code = afsconf_GetExtendedCellInfo(prdir,(char *)0,"afsprot", diff --git a/src/ptserver/ptuser.c b/src/ptserver/ptuser.c index 55c549e..0d4b6b5 100644 --- a/src/ptserver/ptuser.c +++ b/src/ptserver/ptuser.c @@ -181,7 +181,7 @@ afs_int32 pr_Initialize (secLevel, confDir, cell) com_err (whoami, code, "Could not get afs tokens, running unauthenticated."); - bzero (serverconns, sizeof(serverconns)); /* terminate list!!! */ + memset(serverconns, 0, sizeof(serverconns)); /* terminate list!!! */ for (i = 0;i= PR_MAXNAMELEN - pr_realmNameLen - 1) return 0; return 1; } @@ -104,7 +104,7 @@ static afs_int32 CorrectGroupName (ut, aname, cid, oid, cname) if (ntohl(tentry.flags) & PRGRP) { if ((tentry.count == 0) && !admin) return PRGROUPEMPTY; /* terminate prefix at colon if there is one */ - if (prefix = index(tentry.name, ':')) *prefix = 0; + if (prefix = strchr(tentry.name, ':')) *prefix = 0; } prefix = tentry.name; } @@ -112,7 +112,7 @@ static afs_int32 CorrectGroupName (ut, aname, cid, oid, cname) if ((strcmp (prefix, "system") == 0) && !admin) return PRPERM; strcpy (name, aname); /* in case aname & cname are same */ - suffix = index(name, ':'); + suffix = strchr(name, ':'); if (suffix == 0) { /* sysadmin can make groups w/o ':', but they must still look like * legal user names. */ @@ -126,10 +126,10 @@ static afs_int32 CorrectGroupName (ut, aname, cid, oid, cname) } done: /* check for legal name with either group rules or user rules */ - if (suffix = index(cname, ':')) { + if (suffix = strchr(cname, ':')) { /* check for confusing characters */ - if (index(cname, '\n') || /* restrict so recreate can work */ - index(suffix+1, ':')) /* avoid multiple colons */ + if (strchr(cname, '\n') || /* restrict so recreate can work */ + strchr(suffix+1, ':')) /* avoid multiple colons */ return PRBADNAM; } else { if (!CorrectUserName (cname)) return PRBADNAM; @@ -193,7 +193,7 @@ afs_int32 CreateEntry (at, aname, aid, idflag, flag, oid, creator) struct prentry tentry, tent; char *atsign; - bzero(&tentry, sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); if ((oid == 0) || (oid == ANONYMOUSID)) oid = creator; @@ -224,7 +224,7 @@ afs_int32 CreateEntry (at, aname, aid, idflag, flag, oid, creator) return PRBADARG; } - atsign = index(aname,'@'); + atsign = strchr(aname, '@'); if (!atsign) { /* A normal user or group. Pick an id for it */ if (idflag) @@ -431,7 +431,7 @@ afs_int32 RemoveFromEntry (at, aid, bid) afs_int32 hloc; if (aid == bid) return PRINCONSISTENT; - bzero(&hentry,sizeof(hentry)); + memset(&hentry, 0, sizeof(hentry)); temp = FindByID(at,bid); if (temp == 0) return PRNOENT; code = pr_ReadEntry(at, 0, temp, &tentry); @@ -487,7 +487,7 @@ afs_int32 RemoveFromEntry (at, aid, bid) } /* for all coentry slots */ hloc = nptr; nptr = centry.next; - bcopy(¢ry,&hentry,sizeof(centry)); + memcpy(&hentry, ¢ry, sizeof(centry)); } /* while there are coentries */ return PRNOENT; } @@ -505,7 +505,7 @@ afs_int32 DeleteEntry (at, tentry, loc) afs_int32 i; afs_int32 nptr; - if (index(tentry->name,'@')) { + if (strchr(tentry->name,'@')) { if (tentry->flags & PRGRP) { /* If there are still foreign user accounts from that cell don't delete the group */ @@ -594,7 +594,7 @@ afs_int32 DeleteEntry (at, tentry, loc) if (inc_header_word (at, instcount, -1)) return PRDBFAIL; } else { - if (index(tentry->name,'@')) { + if (strchr(tentry->name,'@')) { if (inc_header_word (at, foreigncount, -1)) return PRDBFAIL; } else { if (inc_header_word (at, usercount, -1)) return PRDBFAIL; @@ -698,7 +698,7 @@ afs_int32 AddToEntry (tt, entry, loc, aid) else { entry->next = nptr; } - bzero(&aentry,sizeof(aentry)); + memset(&aentry, 0, sizeof(aentry)); aentry.flags |= PRCONT; aentry.id = entry->id; aentry.next = 0; @@ -1091,8 +1091,8 @@ afs_int32 ChangeEntry (at, aid, cid, name, oid, newid) char oldname[PR_MAXNAMELEN]; char *atsign; - bzero(holder,PR_MAXNAMELEN); - bzero(temp,PR_MAXNAMELEN); + memset(holder, 0, PR_MAXNAMELEN); + memset(temp, 0, PR_MAXNAMELEN); loc = FindByID(at,aid); if (!loc) return PRNOENT; code = pr_ReadEntry(at,0,loc,&tentry); @@ -1163,7 +1163,7 @@ afs_int32 ChangeEntry (at, aid, cid, name, oid, newid) } } - atsign = index(tentry.name, '@'); /* check for foreign entry */ + atsign = strchr(tentry.name, '@'); /* check for foreign entry */ /* Change the owner */ if (oid && (oid != tentry.owner)) { @@ -1216,7 +1216,7 @@ afs_int32 ChangeEntry (at, aid, cid, name, oid, newid) { char *newatsign; - newatsign = index (name, '@'); + newatsign = strchr(name, '@'); if (newatsign != atsign){ /* if they are the same no problem*/ /*if the pointers are not equal the strings better be */ if ((atsign == NULL) || (newatsign == NULL) || @@ -1301,7 +1301,7 @@ AddAuthGroup(tentry, alist, size) prlist *alist; afs_int32 *size; { - if (!(index(tentry->name, '@'))) + if (!(strchr(tentry->name, '@'))) return (AddToPRList (alist, size, AUTHUSERID)); else return PRSUCCESS; diff --git a/src/ptserver/readgroup.c b/src/ptserver/readgroup.c index f7b3401..92bf208 100644 --- a/src/ptserver/readgroup.c +++ b/src/ptserver/readgroup.c @@ -107,14 +107,14 @@ char **argv; if (buf[0] == '\n') break; if (buf[0] != ' ' && buf[0] != '\t') { /* grab the group name */ - bzero(gname,PR_MAXNAMELEN); - bzero(owner,PR_MAXNAMELEN); + memset(gname, 0, PR_MAXNAMELEN); + memset(owner, 0, PR_MAXNAMELEN); sscanf(buf,"%s %d",gname,&id); tmp = buf; skip(&tmp); skip(&tmp); stolower(gname); - ptr = index(gname,':'); + ptr = strchr(gname, ':'); strncpy(owner,gname,ptr-gname); if (strcmp(owner,"system") == 0) strncpy(owner,"system:administrators",PR_MAXNAMELEN); @@ -133,9 +133,9 @@ char **argv; } if (!fail) { /* read members out of buf and add to the group */ - bzero(name,PR_MAXNAMELEN); + memset(name, 0, PR_MAXNAMELEN); while (sscanf(tmp,"%s",name) != EOF) { - if (index(name,':') == NULL) { + if (strchr(name,':') == NULL) { /* then it's not a group */ code = pr_AddToGroup(name,gname); report_error (code, name, gname); @@ -155,7 +155,7 @@ char **argv; } if (lnames.namelist_val) free(lnames.namelist_val); } - bzero(name,PR_MAXNAMELEN); + memset(name, 0, PR_MAXNAMELEN); skip(&tmp); } } @@ -164,11 +164,11 @@ char **argv; /* if we couldn't create the group, and it wasn't already there, don't try to add more users */ if (fail) continue; /* read members out of buf and add to the group */ - bzero(name,PR_MAXNAMELEN); + memset(name, 0, PR_MAXNAMELEN); tmp = buf; tmp++; while (sscanf(tmp,"%s",name) != EOF) { - if (index(name,':') == NULL) { + if (strchr(name,':') == NULL) { /* then it's not a group */ code = pr_AddToGroup(name,gname); report_error (code, name, gname); @@ -188,7 +188,7 @@ char **argv; } if (lnames.namelist_val) free(lnames.namelist_val); } - bzero(name,PR_MAXNAMELEN); + memset(name, 0, PR_MAXNAMELEN); skip(&tmp); } } diff --git a/src/ptserver/readpwd.c b/src/ptserver/readpwd.c index 6f12d4a..7548ea4 100644 --- a/src/ptserver/readpwd.c +++ b/src/ptserver/readpwd.c @@ -82,12 +82,12 @@ char **argv; exit(2); } while ((tmp = fgets(buf,150,fp)) != NULL) { - bzero(name,PR_MAXNAMELEN); - bzero(uid,8); - ptr = index(buf,':'); + memset(name, 0, PR_MAXNAMELEN); + memset(uid, 0, 8); + ptr = strchr(buf, ':'); strncpy(name,buf,ptr-buf); - aptr = index(++ptr,':'); - ptr = index(++aptr,':'); + aptr = strchr(++ptr, ':'); + ptr = strchr(++aptr, ':'); strncpy(uid,aptr,ptr-aptr); id = atoi(uid); if (verbose) diff --git a/src/ptserver/testpt.c b/src/ptserver/testpt.c index 182d514..490eb43 100644 --- a/src/ptserver/testpt.c +++ b/src/ptserver/testpt.c @@ -464,12 +464,12 @@ TestManyMembers (as, arock) population = (char *)malloc (sqr(number)*sizeof(char)); nFilled = 0; - bzero (filled, number); + memset(filled, 0, number); nCleaned = 0; - bzero (cleaned, number); - bzero (population, sqr(number)); - bzero (users, number*sizeof(afs_int32)); - bzero (groups, number*sizeof(afs_int32)); + memset(cleaned, 0, number); + memset(population, 0, sqr(number)); + memset(users, 0, number*sizeof(afs_int32)); + memset(groups, 0, number*sizeof(afs_int32)); ownerUser = lastGroup = 0; groupOwners = (afs_int32 *) malloc (number*sizeof(afs_int32)); @@ -898,7 +898,7 @@ static int MyBeforeProc (as, arock) strncpy (cellinfo.hostName[i], serverList->data, MAXHOSTCHARS); th = gethostbyname(cellinfo.hostName[i]); if (!th) return UBADHOST; - bcopy(th->h_addr, &cellinfo.hostAddr[i].sin_addr, sizeof(afs_int32)); + memcpy(&cellinfo.hostAddr[i].sin_addr, th->h_addr, sizeof(afs_int32)); cellinfo.hostAddr[i].sin_family = AF_INET; cellinfo.hostAddr[i].sin_port = 0; } diff --git a/src/ptserver/utils.c b/src/ptserver/utils.c index d147e2a..1be4793 100644 --- a/src/ptserver/utils.c +++ b/src/ptserver/utils.c @@ -90,7 +90,7 @@ struct prentry *tentry; struct prentry nentry; if (ntohl(1) != 1) { /* Need to swap bytes. */ - bzero (&nentry, sizeof(nentry)); /* make sure reseved fields are zero */ + memset(&nentry, 0, sizeof(nentry)); /* make sure reseved fields are zero */ nentry.flags = htonl(tentry->flags); nentry.id = htonl(tentry->id); nentry.cellid = htonl(tentry->cellid); @@ -140,7 +140,7 @@ struct prentry *tentry; } code = ubik_Read(tt, (char *) &nentry, sizeof(struct prentry)); if (code) return (code); - bzero (tentry, sizeof(*tentry)); /* make sure reseved fields are zero */ + memset(tentry, 0, sizeof(*tentry)); /* make sure reseved fields are zero */ tentry->flags = ntohl(nentry.flags); tentry->id = ntohl(nentry.id); tentry->cellid = ntohl(nentry.cellid); @@ -181,7 +181,7 @@ pr_WriteCoEntry(tt, afd, pos, tentry) struct contentry nentry; if (ntohl(1) != 1) { /* No need to swap */ - bzero (&nentry, sizeof(nentry)); /* make reseved fields zero */ + memset(&nentry, 0, sizeof(nentry)); /* make reseved fields zero */ nentry.flags = htonl(tentry->flags); nentry.id = htonl(tentry->id); nentry.cellid = htonl(tentry->cellid); @@ -211,7 +211,7 @@ struct contentry *tentry; } code = ubik_Read(tt, (char *) &nentry, sizeof(struct contentry)); if (code) return (code); - bzero (tentry, sizeof(*tentry)); /* make reseved fields zero */ + memset(tentry, 0, sizeof(*tentry)); /* make reseved fields zero */ tentry->flags = ntohl(nentry.flags); tentry->id = ntohl(nentry.id); tentry->cellid = ntohl(nentry.cellid); @@ -259,7 +259,7 @@ afs_int32 pos; register afs_int32 code; struct prentry tentry; - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); tentry.next = ntohl(cheader.freePtr); tentry.flags |= PRFREE; cheader.freePtr = htonl(pos); @@ -284,13 +284,13 @@ afs_int32 aid; i = IDHash(aid); entry = ntohl(cheader.idHash[i]); if (entry == 0) return entry; - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); code = pr_ReadEntry(at, 0, entry, &tentry); if (code != 0) return 0; if (aid == tentry.id) return entry; entry = tentry.nextID; while (entry != 0) { - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); code = pr_ReadEntry(at,0,entry,&tentry); if (code != 0) return 0; if (aid == tentry.id) return entry; @@ -314,13 +314,13 @@ struct prentry *tentryp; i = NameHash(aname); entry = ntohl(cheader.nameHash[i]); if (entry == 0) return entry; - bzero(tentryp,sizeof(struct prentry)); + memset(tentryp, 0, sizeof(struct prentry)); code = pr_ReadEntry(at, 0, entry, tentryp); if (code != 0) return 0; if ((strncmp(aname,tentryp->name,PR_MAXNAMELEN)) == 0) return entry; entry = tentryp->nextName; while (entry != 0) { - bzero(tentryp, sizeof(struct prentry)); + memset(tentryp, 0, sizeof(struct prentry)); code = pr_ReadEntry(at,0,entry, tentryp); if (code != 0) return 0; if ((strncmp(aname,tentryp->name,PR_MAXNAMELEN)) == 0) return entry; @@ -436,8 +436,8 @@ afs_int32 *loc; /* ??? in case ID hashed twice ??? */ if ((aid == PRBADID) || (aid == 0)) return PRINCONSISTENT; i = IDHash(aid); current = ntohl(cheader.idHash[i]); - bzero(&tentry,sizeof(tentry)); - bzero(&bentry,sizeof(bentry)); + memset(&tentry, 0, sizeof(tentry)); + memset(&bentry, 0, sizeof(bentry)); trail = 0; if (current == 0) return PRSUCCESS; /* already gone */ code = pr_ReadEntry(tt,0,current,&tentry); @@ -478,7 +478,7 @@ afs_int32 loc; /* ??? */ if ((aid == PRBADID) || (aid == 0)) return PRINCONSISTENT; i = IDHash(aid); - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); code = pr_ReadEntry(tt,0,loc,&tentry); if (code) return PRDBFAIL; tentry.nextID = ntohl(cheader.idHash[i]); @@ -503,8 +503,8 @@ afs_int32 *loc; i = NameHash(aname); current = ntohl(cheader.nameHash[i]); - bzero(&tentry,sizeof(tentry)); - bzero(&bentry,sizeof(bentry)); + memset(&tentry, 0, sizeof(tentry)); + memset(&bentry, 0, sizeof(bentry)); trail = 0; if (current == 0) return PRSUCCESS; /* already gone */ code = pr_ReadEntry(tt,0,current,&tentry); @@ -544,7 +544,7 @@ afs_int32 loc; struct prentry tentry; i = NameHash(aname); - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); code = pr_ReadEntry(tt,0,loc,&tentry); if (code) return PRDBFAIL; tentry.nextName = ntohl(cheader.nameHash[i]); @@ -690,7 +690,7 @@ afs_int32 gid; return PRSUCCESS; } nptr = ntohl(cheader.orphan); - bzero(&bentry,sizeof(bentry)); + memset(&bentry, 0, sizeof(bentry)); loc = 0; while (nptr != 0) { code = pr_ReadEntry(at,0,nptr,&tentry); @@ -707,7 +707,7 @@ afs_int32 gid; } loc = nptr; nptr = tentry.nextOwned; - bcopy(&tentry,&bentry, sizeof(tentry)); + memcpy(&bentry, &tentry, sizeof(tentry)); } return PRSUCCESS; } @@ -765,7 +765,7 @@ afs_int32 gid; if ((gid == 0) || (aid == 0)) return 0; loc = FindByID(at,gid); if (!loc) return 0; - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); code = pr_ReadEntry(at, 0, loc,&tentry); if (code) return 0; if (!(tentry.flags & PRGRP)) return 0; @@ -776,7 +776,7 @@ afs_int32 gid; if (tentry.next) { loc = tentry.next; while (loc) { - bzero(¢ry,sizeof(centry)); + memset(¢ry, 0, sizeof(centry)); code = pr_ReadCoEntry(at,0,loc,¢ry); if (code) return 0; for (i=0;ipw_shell, '/'); + cp = strrchr(pwd->pw_shell, '/'); if (cp) cp++; else diff --git a/src/rlogind/rlogind.c b/src/rlogind/rlogind.c index bc2c688..fd6ae97 100644 --- a/src/rlogind/rlogind.c +++ b/src/rlogind/rlogind.c @@ -239,7 +239,7 @@ main(argc, argv) syslog(LOG_WARNING,MSGSTR(SETDEBUG,"setsockopt (SO_DEBUG): %m")); /*MSG*/ /* set-up signal handler routines for SRC TRACE ON/OFF support */ - bzero((char *)&sa, sizeof(sa)); + memset((char *)&sa, 0, sizeof(sa)); sa.sa_mask.losigs = sigmask(SIGUSR2); sa.sa_handler = trace_handler; sa.sa_flags = SA_RESTART; @@ -378,11 +378,11 @@ doit(f, fromp) hp = gethostbyname(remotehost); if (hp) #if defined(BSD_42) - if (!bcmp(hp->h_addr, (caddr_t)&fromp->sin_addr, + if (!memcmp(hp->h_addr, (caddr_t)&fromp->sin_addr, sizeof(fromp->sin_addr))) { #else /* BSD_42 */ for (; hp->h_addr_list[0]; hp->h_addr_list++) - if (!bcmp(hp->h_addr_list[0], (caddr_t)&fromp->sin_addr, + if (!memcmp(hp->h_addr_list[0], (caddr_t)&fromp->sin_addr, sizeof(fromp->sin_addr))) { #endif /* BSD_42 */ hostok++; @@ -745,7 +745,7 @@ gotpty: { struct sigaction sa; - bzero((char *)&sa, sizeof(sa)); + memset((char *)&sa, 0, sizeof(sa)); sa.sa_handler = SIG_DFL; sigaction(SIGQUIT, &sa, (struct sigaction *)0); sa.sa_handler = SIG_DFL; @@ -779,7 +779,7 @@ gotpty: { struct sigaction sa; - bzero((char *)&sa, sizeof(sa)); + memset((char *)&sa, 0, sizeof(sa)); sa.sa_mask.losigs = sigmask(SIGUSR2); sa.sa_handler = trace_handler; sigaction(SIGUSR1, &sa, (struct sigaction *)0); @@ -911,7 +911,7 @@ control(pty, cp, n) if (n < 4+sizeof (w) || cp[2] != 's' || cp[3] != 's') return (0); oobdata[0] &= ~TIOCPKT_WINDOW; /* we know he heard */ - bcopy(cp+4, (char *)&w, sizeof(w)); + memcpy((char *)&w, cp+4, sizeof(w)); w.ws_row = ntohs(w.ws_row); w.ws_col = ntohs(w.ws_col); w.ws_xpixel = ntohs(w.ws_xpixel); @@ -1031,7 +1031,7 @@ protocol(f, p) if (n) { left -= n; if (left > 0) - bcopy(cp+n, cp, left); + memcpy(cp, cp+n, left); fcc -= n; goto top; /* n^2 */ } @@ -1274,7 +1274,7 @@ setup_term(fd) int fd; { #ifndef AFS_OSF_ENV - register char *cp = index(term, '/'), **cpp; + register char *cp = strchr(term, '/'), **cpp; #endif #ifdef AFS_AIX32_ENV #ifdef _AIX @@ -1301,7 +1301,7 @@ setup_term(fd) if (cp) { *cp++ = '\0'; speed = cp; - cp = index(speed, '/'); + cp = strchr(speed, '/'); if (cp) *cp++ = '\0'; #ifdef _AIX @@ -1364,7 +1364,7 @@ setup_term(fd) #else /* AFS_AIX32_ENV */ #ifdef AFS_OSF_ENV - register char *cp = index(term+ENVSIZE, '/'); + register char *cp = strchr(term+ENVSIZE, '/'); char *speed; struct termios tt; @@ -1372,7 +1372,7 @@ setup_term(fd) if (cp) { *cp++ = '\0'; speed = cp; - cp = index(speed, '/'); + cp = strchr(speed, '/'); if (cp) *cp++ = '\0'; cfsetspeed(&tt, atoi(speed)); @@ -1381,7 +1381,7 @@ setup_term(fd) tt.c_iflag = TTYDEF_IFLAG; tt.c_oflag = TTYDEF_OFLAG; tt.c_lflag = TTYDEF_LFLAG; - bcopy(ttydefchars, tt.c_cc, sizeof(tt.c_cc)); + memcpy(tt.c_cc, ttydefchars, sizeof(tt.c_cc)); tcsetattr(fd, TCSAFLUSH, &tt); #else struct sgttyb sgttyb; @@ -1391,7 +1391,7 @@ setup_term(fd) if (cp) { *cp++ = '\0'; speed = cp; - cp = index(speed, '/'); + cp = strchr(speed, '/'); if (cp) *cp++ = '\0'; for (cpp = speeds; cpp < &speeds[NSPEEDS]; cpp++) @@ -1421,7 +1421,7 @@ local_domain(h) char *h; { char localhost[MAXHOSTNAMELEN]; - char *p1, *p2 = index(h, '.'); + char *p1, *p2 = strchr(h, '.'); #ifdef AFS_OSF_ENV char *topdomain(); @@ -1433,7 +1433,7 @@ local_domain(h) p1 = topdomain(localhost); p2 = topdomain(h); #else - p1 = index(localhost, '.'); + p1 = strchr(localhost, '.'); #endif if (p1 == NULL || p2 == NULL || !strcasecmp(p1, p2)) return(1); @@ -1793,7 +1793,7 @@ int s; /* (5) sessionKey */ bp = bp + index + 1; - bcopy(bp, token.sessionKey.data, 8); + memcpy(token.sessionKey.data, bp, 8); /* (6) kvno */ @@ -1843,7 +1843,7 @@ int s; exit(1); } - bcopy(bp, token.ticket, token.ticketLen); + memcpy(token.ticket, bp, token.ticketLen); bp = bp + token.ticketLen; diff --git a/src/rsh/rcmd.c b/src/rsh/rcmd.c index 6bdf056..166763d 100644 --- a/src/rsh/rcmd.c +++ b/src/rsh/rcmd.c @@ -76,8 +76,6 @@ RCSID("$Header$"); # define DPRINTF(args) #endif -char *index(); - #include static _checkhost(); @@ -116,7 +114,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) struct hostent *hp; fd_set reads; - bzero((char *)someSignals, sizeof(someSignals)); + memset((char *)someSignals, 0, sizeof(someSignals)); someSignals[0] = 1<<(SIGURG-1); sigBlock = *((sigset_t *)someSignals); @@ -156,9 +154,9 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) #endif sin.sin_family = hp->h_addrtype; #ifdef AFS_OSF_ENV - bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length); + memcpy((caddr_t)&sin.sin_addr, hp->h_addr_list[0], hp->h_length); #else - bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length); + memcpy((caddr_t)&sin.sin_addr, hp->h_addr, hp->h_length); #endif sin.sin_port = rport; /* attempt to remote authenticate first... */ @@ -231,8 +229,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) errno = oerrno; perror(0); hp->h_addr_list++; - bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, - hp->h_length); + memcpy((caddr_t)&sin.sin_addr, hp->h_addr_list[0], hp->h_length); fprintf(stderr, "Trying %s...\n", inet_ntoa(sin.sin_addr)); continue; @@ -597,7 +594,7 @@ _checkhost(rhost, lhost, len) return(0); } ldomain[MAXHOSTNAMELEN] = '\0'; - if ((domainp = index(ldomain, '.')) == (char *)NULL) { + if ((domainp = strchr(ldomain, '.')) == (char *)NULL) { nodomain = 1; return(0); } diff --git a/src/rsh/rlogin.c b/src/rsh/rlogin.c index fa61560..d91f8c1 100644 --- a/src/rsh/rlogin.c +++ b/src/rsh/rlogin.c @@ -32,7 +32,7 @@ RCSID("$Header$"); # define TIOCPKT_WINDOW 0x80 # endif /* TIOCPKT_WINDOW */ -char *index(), *rindex(), *malloc(), *getenv(); +char *malloc(), *getenv(); struct passwd *getpwuid(); char *name; int rem; @@ -78,7 +78,7 @@ main(argc, argv) setlocale(LC_ALL,""); #endif - host = rindex(argv[0], '/'); + host = strrchr(argv[0], '/'); if (host) host++; else @@ -372,7 +372,7 @@ sigwinch() struct winsize ws; if (dosigwinch && !nosigwin && ioctl(0, TIOCGWINSZ, &ws) == 0 && - bcmp(&ws, &winsize, sizeof (ws))) { + memcmp(&ws, &winsize, sizeof (ws))) { winsize = ws; sendwindow(); } diff --git a/src/rsh/rsh.c b/src/rsh/rsh.c index 5f4e744..6420563 100644 --- a/src/rsh/rsh.c +++ b/src/rsh/rsh.c @@ -139,7 +139,7 @@ main(argc, argv0) */ check_and_run_afs_vers(argv); #endif - bzero(&ign_act, sizeof(ign_act)); + memset(&ign_act, 0, sizeof(ign_act)); ign_act.sa_handler=SIG_IGN; #endif host = strrchr(argv[0], '/'); @@ -331,7 +331,7 @@ another: } (void) setuid(getuid()); - bzero((char *)someSignals, sizeof(someSignals)); + memset((char *)someSignals, 0, sizeof(someSignals)); #ifdef AFS_HPUX_ENV someSignals[0] = mask(SIGINT)|mask(SIGQUIT)|mask(SIGTERM)|mask(SIGHUP); #else diff --git a/src/rx/AIX/rx_knet.c b/src/rx/AIX/rx_knet.c index 5e80a28..3f4a086 100644 --- a/src/rx/AIX/rx_knet.c +++ b/src/rx/AIX/rx_knet.c @@ -109,7 +109,7 @@ void ip_stripoptions(struct mbuf *m, STRIP_ARG2_TYPE mopt) olen = (ip->ip_hl<<2) - sizeof (struct ip); opts = (caddr_t)(ip + 1); i = m->m_len - (sizeof (struct ip) + olen); - bcopy(opts + olen, opts, (unsigned)i); + memcpy(opts, opts + olen, (unsigned)i); m->m_len -= olen; if (m->m_flags & M_PKTHDR) m->m_pkthdr.len -= olen; @@ -382,7 +382,7 @@ int istack; m->m_len = 0; while (len) { rlen = MIN(len, tl); - bcopy(tdata, tpa, rlen); + memcpy(tpa, tdata, rlen); asize -= rlen; len -= rlen; tpa += rlen; @@ -416,7 +416,7 @@ int istack; m_freem(top); /* free mbuf chain */ return 1; } - bcopy(addr, mtod(um, caddr_t), sizeof(*addr)); + memcpy(mtod(um, caddr_t), addr, sizeof(*addr)); um->m_len = sizeof(*addr); um->m_pkthdr.len = sizeof(*addr); um->m_flags |= M_PKTHDR; diff --git a/src/rx/DARWIN/rx_knet.c b/src/rx/DARWIN/rx_knet.c index 7182cd8..f069eed 100644 --- a/src/rx/DARWIN/rx_knet.c +++ b/src/rx/DARWIN/rx_knet.c @@ -153,7 +153,7 @@ osi_NetSend(asocket, addr, dvec, nvecs, alength, istack) goto bad; } nam->m_len=addr->sin_len=sizeof(struct sockaddr_in); - bcopy((caddr_t)addr, mtod(nam, caddr_t), addr->sin_len); + memcpy(mtod(nam, caddr_t), (caddr_t)addr, addr->sin_len); code = sosend(asocket, mtod(nam, struct sockaddr *), &u, NULL, NULL, 0); m_freem(nam); bad: diff --git a/src/rx/DUX/rx_knet.c b/src/rx/DUX/rx_knet.c index 485ce10..611368c 100644 --- a/src/rx/DUX/rx_knet.c +++ b/src/rx/DUX/rx_knet.c @@ -31,7 +31,7 @@ rxk_init() { /* force UDP checksumming on for AFS */ extern int udpcksum; udpcksum = 1; - bcopy(tpro, &parent_proto, sizeof(parent_proto)); + memcpy(&parent_proto, tpro, sizeof(parent_proto)); tpro->pr_input = rxk_input; tpro->pr_fasttimo = rxk_fasttimo; /* @@ -292,7 +292,7 @@ nopages: tpa = mtod(m, caddr_t); while (len) { rlen = MIN(len, tl); - bcopy(tdata, tpa, rlen); + memcpy(tpa, tdata, rlen); asize -= rlen; len -= rlen; tpa += rlen; @@ -328,7 +328,7 @@ nopages: splx(s); return 1; } - bcopy(addr, mtod(um, caddr_t), sizeof(*addr)); + memcpy(mtod(um, caddr_t), addr, sizeof(*addr)); um->m_len = sizeof(*addr); /* note that udp_usrreq frees funny mbuf. We hold onto data, but mbuf * around it is gone. we free address ourselves. */ diff --git a/src/rx/FBSD/rx_knet.c b/src/rx/FBSD/rx_knet.c index c1f243f..43914fd 100644 --- a/src/rx/FBSD/rx_knet.c +++ b/src/rx/FBSD/rx_knet.c @@ -44,7 +44,7 @@ rxk_init() { /* force UDP checksumming on for AFS */ extern int udpcksum; udpcksum = 1; - bcopy(tpro, &parent_proto, sizeof(parent_proto)); + memcpy(&parent_proto, tpro, sizeof(parent_proto)); tpro->pr_input = rxk_input; tpro->pr_fasttimo = rxk_fasttimo; /* @@ -303,7 +303,7 @@ nopages: tpa = mtod(m, caddr_t); while (len) { rlen = MIN(len, tl); - bcopy(tdata, tpa, rlen); + memcpy(tpa, tdata, rlen); asize -= rlen; len -= rlen; tpa += rlen; @@ -339,7 +339,7 @@ nopages: splx(s); return 1; } - bcopy(addr, mtod(um, caddr_t), sizeof(*addr)); + memcpy(mtod(um, caddr_t), addr, sizeof(*addr)); um->m_len = sizeof(*addr); /* note that udp_usrreq frees funny mbuf. We hold onto data, but mbuf * around it is gone. we free address ourselves. */ diff --git a/src/rx/HPUX/rx_knet.c b/src/rx/HPUX/rx_knet.c index 142891c..625ab53 100644 --- a/src/rx/HPUX/rx_knet.c +++ b/src/rx/HPUX/rx_knet.c @@ -74,7 +74,7 @@ rxk_init() { /* force UDP checksumming on for AFS */ int udpcksum; udpcksum = 1; - bcopy(tpro, &parent_proto, sizeof(parent_proto)); + memcpy(&parent_proto, tpro, sizeof(parent_proto)); tpro->pr_input = rxk_input; tpro->pr_fasttimo = rxk_fasttimo; rxk_initDone = 1; @@ -227,14 +227,14 @@ osi_NetSend(asocket, addr, dvec, nvec, asize, istack) /* Guess based on rxk_NewSocket */ bp = allocb((size+SO_MSGOFFSET+1), BPRI_MED); if (!bp) return ENOBUFS; - bcopy((caddr_t)addr, (caddr_t)bp->b_rptr+SO_MSGOFFSET, size); + memcpy((caddr_t)bp->b_rptr+SO_MSGOFFSET, (caddr_t)addr, size); bp->b_wptr = bp->b_rptr + (size+SO_MSGOFFSET+1); - bcopy((caddr_t)dvec, (caddr_t)temp, nvec * sizeof(struct iovec)); + memcpy((caddr_t)temp, (caddr_t)dvec, nvec * sizeof(struct iovec)); /* devresource.hp.com/Drivers/Docs/Refs/11i/ddRef/Chap02R.pdf has details on use of uio */ - bzero((caddr_t)&uio, sizeof(uio)); + memset((caddr_t)&uio, 0, sizeof(uio)); uio.uio_resid = asize; uio.uio_iov = temp; uio.uio_iovcnt = nvec; @@ -258,7 +258,7 @@ int osi_NetReceive(struct socket *so, struct sockaddr_in *from, if (iovcnt > RX_MAXWVECS+2) { osi_Panic("Too many (%d) iovecs passed to osi_NetReceive\n", iovcnt); } - bcopy((char*)iov, tmpvec, iovcnt/*(RX_MAXWVECS+1)*/ * sizeof(struct iovec)); + memcpy(tmpvec, (char*)iov, iovcnt/*(RX_MAXWVECS+1)*/ * sizeof(struct iovec)); tuio.uio_iov = tmpvec; tuio.uio_iovcnt = iovcnt; tuio.uio_fpflags = 0; @@ -270,7 +270,7 @@ int osi_NetReceive(struct socket *so, struct sockaddr_in *from, if (!code) { *lengthp = *lengthp - tuio.uio_resid; if (bp) { - bcopy((char*)bp->b_rptr, (char*)from, sizeof(struct sockaddr_in)); + memcpy((char*)from, (char*)bp->b_rptr, sizeof(struct sockaddr_in)); } else { code = -1; } diff --git a/src/rx/IRIX/rx_knet.c b/src/rx/IRIX/rx_knet.c index 40e51bd..4e02690 100644 --- a/src/rx/IRIX/rx_knet.c +++ b/src/rx/IRIX/rx_knet.c @@ -68,7 +68,7 @@ int osi_NetReceive(osi_socket so, struct sockaddr_in *from, if (iovcnt > RX_MAXWVECS+2) { osi_Panic("Too many (%d) iovecs passed to osi_NetReceive\n", iovcnt); } - bcopy((char*)iov, tmpvec, (RX_MAXWVECS+1) * sizeof(struct iovec)); + memcpy(tmpvec, (char*)iov, (RX_MAXWVECS+1) * sizeof(struct iovec)); #ifdef AFS_SGI65_ENV code = soreceive(&bhv, &maddr, &tuio, NULL, NULL); #else @@ -103,7 +103,7 @@ int osi_NetReceive(osi_socket so, struct sockaddr_in *from, else { *lengthp = *lengthp - tuio.uio_resid; if (maddr) { - bcopy((char*)mtod(maddr, struct sockaddr_in *), (char*)from, + memcpy((char*)from, (char*)mtod(maddr, struct sockaddr_in *), sizeof(struct sockaddr_in)); m_freem(maddr); } @@ -262,7 +262,7 @@ void rxk_init(void) { last = inetdomain.dom_protoswNPROTOSW; for (tpro = inetdomain.dom_protosw; tpro < last; tpro++) { if (tpro->pr_protocol == IPPROTO_UDP) { - bcopy(tpro, &parent_proto, sizeof(parent_proto)); + memcpy(&parent_proto, tpro, sizeof(parent_proto)); tpro->pr_input = rxk_input; tpro->pr_fasttimo = rxk_fasttimo; rxk_initDone = 1; @@ -424,7 +424,7 @@ osi_NetSend(asocket, addr, dvec, nvec, asize, istack) if (nvec > RX_MAXWVECS+1) { osi_Panic("osi_NetSend: %d: Too many iovecs.\n", nvec); } - bcopy((char*)dvec, (char*)tvecs, nvec * sizeof(struct iovec)); + memcpy((char*)tvecs, (char*)dvec, nvec * sizeof(struct iovec)); tuio.uio_iov = tvecs; tuio.uio_iovcnt = nvec; @@ -441,7 +441,7 @@ osi_NetSend(asocket, addr, dvec, nvec, asize, istack) to = m_get(M_WAIT, MT_SONAME); to->m_len = sizeof(struct sockaddr_in); - bcopy((char*)addr, mtod(to, caddr_t), to->m_len); + memcpy(mtod(to, caddr_t), (char*)addr, to->m_len); BHV_PDATA(&bhv) = (void*)asocket; code = sosend(&bhv, to, &tuio, 0, NULL); @@ -522,7 +522,7 @@ osi_NetSend(asocket, addr, dvec, nvec, asize, istack) tpa = mtod(m, caddr_t); while (len) { rlen = MIN(len, tl); - bcopy(tdata, tpa, rlen); + memcpy(tpa, tdata, rlen); asize -= rlen; len -= rlen; tpa += rlen; @@ -559,7 +559,7 @@ osi_NetSend(asocket, addr, dvec, nvec, asize, istack) AFS_SBUNLOCK(&asocket->so_snd, NETEVENT_SODOWN, asocket, s1); return 1; } - bcopy(addr, mtod(um, caddr_t), sizeof(*addr)); + memcpy(mtod(um, caddr_t), addr, sizeof(*addr)); um->m_len = sizeof(*addr); /* note that udp_usrreq frees funny mbuf. We hold onto data, but mbuf * around it is gone. we free address ourselves. */ diff --git a/src/rx/SOLARIS/rx_knet.c b/src/rx/SOLARIS/rx_knet.c index 983e1a4..9598b91 100644 --- a/src/rx/SOLARIS/rx_knet.c +++ b/src/rx/SOLARIS/rx_knet.c @@ -240,7 +240,7 @@ int osi_NetReceive(asocket, addr, dvec, nvecs, alength) if (msg.msg_name == NULL) { error = -1; } else { - bcopy(msg.msg_name, addr, msg.msg_namelen); + memcpy(addr, msg.msg_name, msg.msg_namelen); kmem_free(msg.msg_name, msg.msg_namelen); *alength = *alength - uio.uio_resid; } @@ -350,7 +350,7 @@ struct osi_socket *rxk_NewSocket(short aport) t_kclose(udp_tiptr, 0); return (struct osi_socket *)0; } - if (bcmp(reqp->addr.buf, rspp->addr.buf, rspp->addr.len)) { + if (memcmp(reqp->addr.buf, rspp->addr.buf, rspp->addr.len)) { t_kfree(udp_tiptr, (char *)reqp, T_BIND); t_kfree(udp_tiptr, (char *)rspp, T_BIND); t_kclose(udp_tiptr, 0); @@ -422,7 +422,7 @@ int osi_NetSend(asocket, addr, dvec, nvecs, asize, istack) } /* Copy the data into the buffer */ - bcopy((char *)dvec[0].iov_base, (char *)bp->b_wptr, dvec[0].iov_len); + memcpy((char *)bp->b_wptr, (char *)dvec[0].iov_base, dvec[0].iov_len); bp->b_datap->db_type = M_DATA; bp->b_wptr += dvec[0].iov_len; @@ -439,7 +439,7 @@ int osi_NetSend(asocket, addr, dvec, nvecs, asize, istack) } /* Copy the data into the buffer */ - bcopy((char *)dvec[i].iov_base, (char *)dbp->b_wptr, dvec[i].iov_len); + memcpy((char *)dbp->b_wptr, (char *)dvec[i].iov_base, dvec[i].iov_len); dbp->b_datap->db_type = M_DATA; dbp->b_wptr += dvec[i].iov_len; @@ -461,7 +461,7 @@ int osi_NetSend(asocket, addr, dvec, nvecs, asize, istack) udreq->addr.buf = (char *)kmem_alloc(sizeof(struct sockaddr_in), KM_SLEEP); udreq->opt.len = 0; udreq->opt.maxlen = 0; - bcopy((char *)&sin, udreq->addr.buf, sizeof(struct sockaddr_in)); + memcpy(udreq->addr.buf, (char *)&sin, sizeof(struct sockaddr_in)); udreq->udata.udata_mp = bp; udreq->udata.len = asize; @@ -563,7 +563,7 @@ int osi_NetReceive(asocket, addr, dvec, nvecs, alength) /* * Save the source address */ - bcopy(udreq->addr.buf, (char *)addr, sizeof(struct sockaddr_in)); + memcpy((char *)addr, udreq->addr.buf, sizeof(struct sockaddr_in)); /* * Copy out the message buffers, take care not to overflow @@ -580,12 +580,12 @@ int osi_NetReceive(asocket, addr, dvec, nvecs, alength) while (dbp != NULL && tlen > 0) { blen = dbp->b_wptr - dbp->b_rptr; if (blen > tlen) { - bcopy((char *)dbp->b_rptr, tbase, tlen); + memcpy(tbase, (char *)dbp->b_rptr, tlen); length -= tlen; dbp->b_rptr += tlen; tlen = 0; } else { - bcopy((char *)dbp->b_rptr, tbase, blen); + memcpy(tbase, (char *)dbp->b_rptr, blen); length -= blen; tlen -= blen; tbase += blen; diff --git a/src/rx/bulk.example/bulk_client.c b/src/rx/bulk.example/bulk_client.c index fb5d6bb..a4f743e 100644 --- a/src/rx/bulk.example/bulk_client.c +++ b/src/rx/bulk.example/bulk_client.c @@ -35,7 +35,7 @@ static u_long GetIpAddress(hostname) printf("host address is disagreeable length (%d)", hostent->h_length); exit(1); } - bcopy(hostent->h_addr, (char *)&host, sizeof(host)); + memcpy((char *)&host, hostent->h_addr, sizeof(host)); return host; } diff --git a/src/rx/bulktest/bulk_client.c b/src/rx/bulktest/bulk_client.c index aff63df..607ded7 100644 --- a/src/rx/bulktest/bulk_client.c +++ b/src/rx/bulktest/bulk_client.c @@ -45,7 +45,7 @@ static u_long GetIpAddress(hostname) printf("host address is disagreeable length (%d)", hostent->h_length); exit(1); } - bcopy(hostent->h_addr, (char *)&host, sizeof(host)); + memcpy((char *)&host, hostent->h_addr, sizeof(host)); return host; } @@ -116,7 +116,7 @@ async_BulkTest(host, conn, store, count, verbose, file) work->store = store; work->count = count; work->verbose = verbose; - name = (char *)rindex(file, '/'); + name = strrchr(file, '/'); if (!name) name = file; else name++; /* sprintf(tempfile, "/usr/tmp/%s.%s", myHostName, name);*/ sprintf(tempfile, "/usr/tmp/%s", name); diff --git a/src/rx/multi.example/sample_client.c b/src/rx/multi.example/sample_client.c index 624d275..ca5fd8f 100644 --- a/src/rx/multi.example/sample_client.c +++ b/src/rx/multi.example/sample_client.c @@ -33,7 +33,7 @@ static u_long GetIpAddress(hostname) printf("host address is disagreeable length (%d)", hostent->h_length); exit(1); } - bcopy(hostent->h_addr, (char *)&host, sizeof(host)); + memcpy((char *)&host, hostent->h_addr, sizeof(host)); return host; } diff --git a/src/rx/rx.c b/src/rx/rx.c index 57c548b..e594f2b 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -431,14 +431,14 @@ int rx_Init(u_int port) rxi_nCalls = 0; rx_connDeadTime = 12; rx_tranquil = 0; /* reset flag */ - bzero((char *)&rx_stats, sizeof(struct rx_stats)); + memset((char *)&rx_stats, 0, sizeof(struct rx_stats)); htable = (char *) osi_Alloc(rx_hashTableSize*sizeof(struct rx_connection *)); PIN(htable, rx_hashTableSize*sizeof(struct rx_connection *)); /* XXXXX */ - bzero(htable, rx_hashTableSize*sizeof(struct rx_connection *)); + memset(htable, 0, rx_hashTableSize*sizeof(struct rx_connection *)); ptable = (char *) osi_Alloc(rx_hashTableSize*sizeof(struct rx_peer *)); PIN(ptable, rx_hashTableSize*sizeof(struct rx_peer *)); /* XXXXX */ - bzero(ptable, rx_hashTableSize*sizeof(struct rx_peer *)); + memset(ptable, 0, rx_hashTableSize*sizeof(struct rx_peer *)); /* Malloc up a bunch of packets & buffers */ rx_nFreePackets = 0; @@ -2103,7 +2103,7 @@ register size_t size; p = (char *) osi_Alloc(size); #endif if (!p) osi_Panic("rxi_Alloc error"); - bzero(p, size); + memset(p, 0, size); return p; } @@ -5988,8 +5988,8 @@ static int MakeDebugCall( theader.flags = RX_CLIENT_INITIATED | RX_LAST_PACKET; theader.serviceId = 0; - bcopy(&theader, tbuffer, sizeof(theader)); - bcopy(inputData, tp, inputLength); + memcpy(tbuffer, &theader, sizeof(theader)); + memcpy(tp, inputData, inputLength); code = sendto(socket, tbuffer, inputLength+sizeof(struct rx_header), 0, (struct sockaddr *) &taddr, sizeof(struct sockaddr_in)); @@ -6005,7 +6005,7 @@ static int MakeDebugCall( code = recvfrom(socket, tbuffer, sizeof(tbuffer), 0, (struct sockaddr *) &faddr, &faddrLen); - bcopy(tbuffer, &theader, sizeof(struct rx_header)); + memcpy(&theader, tbuffer, sizeof(struct rx_header)); if (counter == ntohl(theader.callNumber)) break; } @@ -6014,7 +6014,7 @@ static int MakeDebugCall( } code -= sizeof(struct rx_header); if (code > outputLength) code = outputLength; - bcopy(tp, outputData, code); + memcpy(outputData, tp, code); return code; } diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index 3eb361d..6072092 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -440,8 +440,8 @@ void shutdown_rxkernel(void) for (tpro = inetdomain.dom_protosw; tpro < last; tpro++) if (tpro->pr_protocol == IPPROTO_UDP) { /* restore original udp protocol switch */ - bcopy((void *)&parent_proto, (void *)tpro, sizeof(parent_proto)); - bzero((void *)&parent_proto, sizeof(parent_proto)); + memcpy((void *)tpro, (void *)&parent_proto, sizeof(parent_proto)); + memset((void *)&parent_proto, 0, sizeof(parent_proto)); rxk_initDone = 0; rxk_shutdownPorts(); return; @@ -468,8 +468,8 @@ int rxi_GetcbiInfo() afs_uint32 addrs[ADDRSPERSITE]; int mtus[ADDRSPERSITE]; - bzero((void *)addrs, sizeof(addrs)); - bzero((void *)mtus, sizeof(mtus)); + memset((void *)addrs, 0, sizeof(addrs)); + memset((void *)mtus, 0, sizeof(mtus)); for (i=0; ib_rptr+SO_MSGOFFSET, addrsize); + memcpy((caddr_t)bindnam->b_rptr+SO_MSGOFFSET, (caddr_t)&myaddr, addrsize); bindnam->b_wptr = bindnam->b_rptr + (addrsize+SO_MSGOFFSET+1); code = sobind(newSocket, bindnam, addrsize); @@ -794,7 +794,7 @@ struct osi_socket *rxk_NewSocket(short aport) #ifdef AFS_OSF_ENV myaddr.sin_len = nam->m_len; #endif /* AFS_OSF_ENV */ - bcopy(&myaddr, mtod(nam, caddr_t), sizeof(myaddr)); + memcpy(mtod(nam, caddr_t), &myaddr, sizeof(myaddr)); #ifdef AFS_SGI65_ENV BHV_PDATA(&bhv) = (void*)newSocket; code = sobind(&bhv, nam); diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index 371b6f5..602ed5d8 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -173,7 +173,7 @@ afs_int32 rx_SlowReadPacket(struct rx_packet *packet, unsigned int offset, r = resid; while ((resid > 0) && (i < packet->niovecs)) { j = MIN (resid, packet->wirevec[i].iov_len - (offset - l)); - bcopy ((char *)(packet->wirevec[i].iov_base) + (offset - l), out, j); + memcpy(out, (char *)(packet->wirevec[i].iov_base) + (offset - l), j); resid -= j; l += packet->wirevec[i].iov_len; i++; @@ -213,7 +213,7 @@ afs_int32 rx_SlowWritePacket(struct rx_packet *packet, int offset, int resid, b = (char*)(packet->wirevec[i].iov_base) + (offset - l); j = MIN (resid, packet->wirevec[i].iov_len - (offset - l)); - bcopy (in, b, j); + memcpy(b, in, j); resid -= j; l += packet->wirevec[i].iov_len; i++; @@ -365,7 +365,7 @@ void rxi_MorePackets(int apackets) p = rx_mallocedP = (struct rx_packet *) osi_Alloc(getme); PIN(p, getme); /* XXXXX */ - bzero((char *)p, getme); + memset((char *)p, 0, getme); NETPRI; AFS_RXGLOCK(); MUTEX_ENTER(&rx_freePktQ_lock); @@ -403,7 +403,7 @@ void rxi_MorePacketsNoLock(int apackets) getme = apackets * sizeof(struct rx_packet); p = rx_mallocedP = (struct rx_packet *) osi_Alloc(getme); - bzero((char *)p, getme); + memset((char *)p, 0, getme); for (e = p + apackets; pwirevec[0].iov_base = (char *) (p->wirehead); @@ -789,7 +789,7 @@ int rxi_ReadPacket(socket, p, host, port) savelen = p->wirevec[p->niovecs].iov_len; p->wirevec[p->niovecs].iov_len += RX_EXTRABUFFERSIZE; - bzero((char *)&msg, sizeof(msg)); + memset((char *)&msg, 0, sizeof(msg)); msg.msg_name = (char *) &from; msg.msg_namelen = sizeof(struct sockaddr_in); msg.msg_iov = p->wirevec; @@ -977,7 +977,7 @@ static int cpytoc(mp, off, len, cp) return -1; } n = MIN(len, (mp->b_wptr - mp->b_rptr)); - bcopy((char *)mp->b_rptr, cp, n); + memcpy(cp, (char *)mp->b_rptr, n); cp += n; len -= n; mp->b_rptr += n; @@ -1009,7 +1009,7 @@ static int cpytoiovec(mp, off, len, iovs, niovs) t = iovs[i].iov_len; } m = MIN(n,t); - bcopy((char *)mp->b_rptr, iovs[i].iov_base + o, m); + memcpy(iovs[i].iov_base + o, (char *)mp->b_rptr, m); mp->b_rptr += m; o += m; t -= m; @@ -1052,7 +1052,7 @@ static int m_cpytoiovec(m, off, len, iovs, niovs) while (len) { t = MIN(l1, MIN(l2, (unsigned int)len)); - bcopy (p1, p2, t); + memcpy(p2, p1, t); p1 += t; p2 += t; l1 -= t; l2 -= t; len -= t; @@ -1135,7 +1135,7 @@ struct rx_packet *rxi_ReceiveDebugPacket(ap, asocket, ahost, aport, istack) struct rx_debugStats tstat; /* get basic stats */ - bzero ((char *)&tstat, sizeof(tstat)); /* make sure spares are zero */ + memset((char *)&tstat, 0, sizeof(tstat)); /* make sure spares are zero */ tstat.version = RX_DEBUGI_VERSION; #ifndef RX_ENABLE_LOCKS tstat.waitingForPackets = rx_waitingForPackets; @@ -1176,7 +1176,7 @@ struct rx_packet *rxi_ReceiveDebugPacket(ap, asocket, ahost, aport, istack) if (tl > 0) return ap; - bzero ((char *)&tconn, sizeof(tconn)); /* make sure spares are zero */ + memset((char *)&tconn, 0, sizeof(tconn)); /* make sure spares are zero */ /* get N'th (maybe) "interesting" connection info */ for(i=0;i 0) return ap; - bzero ((char *)&tpeer, sizeof(tpeer)); + memset((char *)&tpeer, 0, sizeof(tpeer)); for(i=0;iheader.flags = ap->header.flags & ~RX_CLIENT_INITIATED; rxi_EncodePacketHeader(ap); - bzero(buf, sizeof(buf)); + memset(buf, 0, sizeof(buf)); strncpy(buf, cml_version_number+4, sizeof(buf)-1); rx_packetwrite(ap, 0, 65, buf); tl = ap->length; @@ -1832,7 +1832,7 @@ register struct rx_packet *p; { register afs_uint32 *buf = (afs_uint32 *)(p->wirevec[0].iov_base); /* MTUXXX */ - bzero((char *)buf, RX_HEADER_SIZE); + memset((char *)buf, 0, RX_HEADER_SIZE); *buf++ = htonl(p->header.epoch); *buf++ = htonl(p->header.cid); *buf++ = htonl(p->header.callNumber); diff --git a/src/rx/rx_packet.h b/src/rx/rx_packet.h index 8941e26..4c5e218 100644 --- a/src/rx/rx_packet.h +++ b/src/rx/rx_packet.h @@ -313,13 +313,13 @@ struct rx_packet *rxi_SplitJumboPacket(); #define rx_packetwrite(p, off, len, in) \ ( (off) + (len) > (p)->wirevec[1].iov_len ? \ rx_SlowWritePacket(p, off, len, (char*)(in)) : \ - ((bcopy((char *)(in), (char*)((p)->wirevec[1].iov_base)+(off), (len))),0)) + ((memcpy((char*)((p)->wirevec[1].iov_base)+(off), (char *)(in), (len))),0)) /* copy data from an RX packet */ #define rx_packetread(p, off, len, out) \ ( (off) + (len) > (p)->wirevec[1].iov_len ? \ rx_SlowReadPacket(p, off, len, (char*)out) : \ - ((bcopy((char*)((p)->wirevec[1].iov_base)+(off), (char *)(out), len)),0)) + ((memcpy((char *)(out), (char*)((p)->wirevec[1].iov_base)+(off), len)),0)) #define rx_computelen(p,l) { register int i; \ for (l=0, i=1; i < p->niovecs; i++ ) l += p->wirevec[i].iov_len; } diff --git a/src/rx/rx_rdwr.c b/src/rx/rx_rdwr.c index 7464826..50fcc1d 100644 --- a/src/rx/rx_rdwr.c +++ b/src/rx/rx_rdwr.c @@ -250,7 +250,7 @@ MTUXXX doesn't there need to be an "else" here ??? while (nbytes && cp) { t = MIN((int)call->curlen, nbytes); t = MIN(t, (int)call->nLeft); - bcopy (call->curpos, buf, t); + memcpy(buf, call->curpos, t); buf += t; nbytes -= t; call->curpos += t; @@ -325,7 +325,7 @@ int rx_ReadProc(call, buf, nbytes) tnLeft = call->nLeft; if (!call->error && tcurlen > nbytes && tnLeft > nbytes) { tcurpos = call->curpos; - bcopy(tcurpos, buf, nbytes); + memcpy(buf, tcurpos, nbytes); call->curpos = tcurpos + nbytes; call->curlen = tcurlen - nbytes; call->nLeft = tnLeft - nbytes; @@ -383,7 +383,7 @@ int rx_ReadProc32(call, value) if (!((long)tcurpos & (sizeof(afs_int32)-1))) { *value = *((afs_int32 *)(tcurpos)); } else { - bcopy(tcurpos, (char *)value, sizeof(afs_int32)); + memcpy((char *)value, tcurpos, sizeof(afs_int32)); } call->curpos = tcurpos + sizeof(afs_int32); call->curlen = tcurlen - sizeof(afs_int32); @@ -795,7 +795,7 @@ int rxi_WriteProc(call, buf, nbytes) t = MIN((int)call->curlen, nbytes); t = MIN((int)call->nFree, t); - bcopy (buf, call->curpos, t); + memcpy(call->curpos, buf, t); buf += t; nbytes -= t; call->curpos += t; @@ -862,7 +862,7 @@ int rx_WriteProc(call, buf, nbytes) tnFree = (int)call->nFree; if (!call->error && tcurlen >= nbytes && tnFree >= nbytes) { tcurpos = call->curpos; - bcopy(buf, tcurpos, nbytes); + memcpy(tcurpos, buf, nbytes); call->curpos = tcurpos + nbytes; call->curlen = tcurlen - nbytes; call->nFree = tnFree - nbytes; @@ -920,7 +920,7 @@ int rx_WriteProc32(call, value) if (!((long)tcurpos & (sizeof(afs_int32)-1))) { *((afs_int32 *)(tcurpos)) = *value; } else { - bcopy((char *)value, tcurpos, sizeof(afs_int32)); + memcpy(tcurpos, (char *)value, sizeof(afs_int32)); } call->curpos = tcurpos + sizeof(afs_int32); call->curlen = tcurlen - sizeof(afs_int32); diff --git a/src/rx/rx_stream.c b/src/rx/rx_stream.c index 25910d4..ce6aef9 100644 --- a/src/rx/rx_stream.c +++ b/src/rx/rx_stream.c @@ -58,11 +58,11 @@ int rx_stream_ReadProc(sd, buf, nbytes) } if (nbytes < sd->sd.rd.nLeft) { sd->sd.rd.nLeft -= nbytes; - bcopy(sd->sd.rd.nextByte, buf, nbytes); + memcpy(buf, sd->sd.rd.nextByte, nbytes); sd->sd.rd.nextByte += nbytes; return totalBytes; } - bcopy(sd->sd.rd.nextByte, buf, sd->sd.rd.nLeft); + memcpy(buf, sd->sd.rd.nextByte, sd->sd.rd.nLeft); buf += sd->sd.rd.nLeft; nbytes -= sd->sd.rd.nLeft; tp = queue_First(&sd->sd.rd.rq, rx_packet); @@ -152,13 +152,13 @@ int rx_stream_WriteProc(sd, buf, nbytes) sd->sd.wd.freePtr = rx_DataOf(queue_First(&sd->sd.wd.wq, rx_packet)); } if (nbytes < sd->sd.wd.nFree) { - if (buf) bcopy(buf, sd->sd.wd.freePtr, nbytes), buf += nbytes; + if (buf) memcpy(sd->sd.wd.freePtr, buf, nbytes), buf += nbytes; sd->sd.wd.nFree -= nbytes; sd->sd.wd.freePtr += nbytes; nbytes = 0; break; } - if (buf) bcopy(buf, sd->sd.wd.freePtr, sd->sd.wd.nFree), buf += sd->sd.wd.nFree; + if (buf) memcpy(sd->sd.wd.freePtr, buf, sd->sd.wd.nFree), buf += sd->sd.wd.nFree; nbytes -= sd->sd.wd.nFree; sd->sd.wd.nFree = 0; if (rx_stream_FlushWrite(sd)) break; diff --git a/src/rx/rx_stream.h b/src/rx/rx_stream.h index b886eec..66dcb1d 100644 --- a/src/rx/rx_stream.h +++ b/src/rx/rx_stream.h @@ -64,7 +64,7 @@ int rx_stream_AllocIov(); /* If it returns 0, the call status should be checked with rx_Error. */ #define rx_stream_Write(iod, buf, nbytes) \ (iod)->sd.wd.nFree > (nbytes) ? \ - (buf) && bcopy((buf), (iod)->sd.wd.freePtr, (nbytes)), \ + (buf) && memcpy((iod)->sd.wd.freePtr, (buf), (nbytes)), \ (iod)->sd.wd.nFree -= (nbytes), \ (iod)->sd.wd.freePtr += (nbytes), (nbytes) \ : rx_stream_WriteProc((iod), (buf), (nbytes)) @@ -74,7 +74,7 @@ int rx_stream_AllocIov(); /* If it returns less than requested, the call status should be checked with rx_Error */ #define rx_stream_Read(iod, buf, nbytes) \ (iod)->sd.rd.nLeft > (nbytes) ? \ - bcopy((iod)->sd.rd.nextByte, (buf), (nbytes)), \ + memcpy((buf), (iod)->sd.rd.nextByte, (nbytes)), \ (iod)->sd.rd.nLeft -= (nbytes), (iod)->sd.rd.nextByte += (nbytes), (nbytes) \ : rx_stream_ReadProc((iod), (buf), (nbytes)) diff --git a/src/rx/rx_trace.c b/src/rx/rx_trace.c index 3fd94f0..05f0589 100644 --- a/src/rx/rx_trace.c +++ b/src/rx/rx_trace.c @@ -119,7 +119,7 @@ void rxi_calltrace(event, call) break; } - bcopy(&rxtinfo, rxi_tracebuf+rxi_tracepos, sizeof(struct rx_trace)); + memcpy(rxi_tracebuf+rxi_tracepos, &rxtinfo, sizeof(struct rx_trace)); rxi_tracepos += sizeof(struct rx_trace); if (rxi_tracepos >= (4096 - sizeof(struct rx_trace))) rxi_flushtrace(); diff --git a/src/rx/rx_user.c b/src/rx/rx_user.c index f39d0e2..0472a86 100644 --- a/src/rx/rx_user.c +++ b/src/rx/rx_user.c @@ -372,10 +372,10 @@ void rx_GetIFInfo() LOCK_IF rxi_numNetAddrs = 0; - bzero(rxi_NetAddrs, sizeof(rxi_NetAddrs)); - bzero(myNetFlags, sizeof(myNetFlags)); - bzero(myNetMTUs, sizeof(myNetMTUs)); - bzero(myNetMasks, sizeof(myNetMasks)); + memset(rxi_NetAddrs, 0, sizeof(rxi_NetAddrs)); + memset(myNetFlags, 0, sizeof(myNetFlags)); + memset(myNetMTUs, 0, sizeof(myNetMTUs)); + memset(myNetMasks, 0, sizeof(myNetMasks)); UNLOCK_IF s = socket(AF_INET, SOCK_DGRAM, 0); @@ -389,7 +389,7 @@ void rx_GetIFInfo() #else ifc.ifc_len = sizeof(ifs); ifc.ifc_buf = (caddr_t) &ifs[0]; - bzero(&ifs[0], sizeof(ifs)); + memset(&ifs[0], 0, sizeof(ifs)); #endif res = ioctl(s, SIOCGIFCONF, &ifc); if (res < 0) { diff --git a/src/rx/rxdebug.c b/src/rx/rxdebug.c index 7e525ae..67d9d18 100644 --- a/src/rx/rxdebug.c +++ b/src/rx/rxdebug.c @@ -159,7 +159,7 @@ struct cmd_syndesc *as; printf("rxdebug: host %s not found in host table\n", name); exit(1); } - bcopy(th->h_addr, &onlyHost, sizeof(afs_int32)); + memcpy(&onlyHost, th->h_addr, sizeof(afs_int32)); } else onlyHost = -1; if (as->parms[9].items) { @@ -184,7 +184,7 @@ struct cmd_syndesc *as; printf("rxdebug: host %s not found in host table\n", hostName); exit(1); } - bcopy(th->h_addr, &host, sizeof(afs_int32)); + memcpy(&host, th->h_addr, sizeof(afs_int32)); } else host = htonl(0x7f000001); /* IP localhost */ diff --git a/src/rx/simple.example/sample_client.c b/src/rx/simple.example/sample_client.c index c466ffb..1b0d73d 100644 --- a/src/rx/simple.example/sample_client.c +++ b/src/rx/simple.example/sample_client.c @@ -29,7 +29,7 @@ static u_long GetIpAddress(hostname) printf("host address is disagreeable length (%d)", hostent->h_length); exit(1); } - bcopy(hostent->h_addr, (char *)&host, sizeof(host)); + memcpy((char *)&host, hostent->h_addr, sizeof(host)); return host; } diff --git a/src/rx/test/kctest.c b/src/rx/test/kctest.c index 9a08dd4..c5a18a5 100644 --- a/src/rx/test/kctest.c +++ b/src/rx/test/kctest.c @@ -36,8 +36,8 @@ static MakeVTest(akey, aticket, asession) struct rxvab_EncryptionKey *akey, *asession; struct rxvab_Ticket *aticket; { aticket->ViceId = htonl(71); - bcopy("testkeyx", &aticket->HandShakeKey, 8); - bcopy("testkeyx", asession, 8); + memcpy(&aticket->HandShakeKey, "testkeyx", 8); + memcpy(asession, "testkeyx", 8); bcrypt_encrypt(aticket, aticket, sizeof(struct rxvab_Ticket), akey); return 0; } @@ -71,7 +71,7 @@ char **argv; { printf("could not find host '%s' in host table\n", argv[i+1]); return -1; } - bcopy(th->h_addr, &host, sizeof(long)); + memcpy(&host, th->h_addr, sizeof(long)); i++; } else if (!strcmp(argv[i],"-count")) { diff --git a/src/rx/test/testclient.c b/src/rx/test/testclient.c index c13a13d..9c57d6f 100644 --- a/src/rx/test/testclient.c +++ b/src/rx/test/testclient.c @@ -179,7 +179,7 @@ char **argv; if (!hostent) Abort("host %s not found", hostname); if (hostent->h_length != 4) Abort("host address is disagreeable length (%d)", hostent->h_length); - bcopy(hostent->h_addr, (char *)&host, sizeof(host)); + memcpy((char *)&host, hostent->h_addr, sizeof(host)); if (setFD>0) OpenFD(setFD); if (rx_Init(0) != 0) { diff --git a/src/rx/xdr_afsuuid.c b/src/rx/xdr_afsuuid.c index a523b0d..f975acb 100644 --- a/src/rx/xdr_afsuuid.c +++ b/src/rx/xdr_afsuuid.c @@ -19,7 +19,9 @@ RCSID("$Header$"); #if defined(KERNEL) && !defined(UKERNEL) #ifdef AFS_LINUX20_ENV #include "../h/string.h" -#define bzero(A,C) memset((A), 0, (C)) +#if 0 +#define bzero(A, C) memset((A), 0, (C)) +#endif #else #include #include diff --git a/src/rx/xdr_array.c b/src/rx/xdr_array.c index 200f6fc..ea5de24 100644 --- a/src/rx/xdr_array.c +++ b/src/rx/xdr_array.c @@ -46,7 +46,9 @@ RCSID("$Header$"); #include #ifdef AFS_LINUX20_ENV #include "../h/string.h" +#if 0 #define bzero(A,C) memset((A), 0, (C)) +#endif #else #include #endif /* AFS_LINUX20_ENV */ @@ -107,7 +109,7 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc) if (target == NULL) { return (FALSE); } - bzero(target, (u_int)nodesize); + memset(target, 0, (u_int)nodesize); break; case XDR_FREE: diff --git a/src/rx/xdr_arrayn.c b/src/rx/xdr_arrayn.c index 0293dbb..e89322a 100644 --- a/src/rx/xdr_arrayn.c +++ b/src/rx/xdr_arrayn.c @@ -46,7 +46,9 @@ RCSID("$Header$"); #include #ifdef AFS_LINUX20_ENV #include "../h/string.h" +#if 0 #define bzero(A,C) memset((A), 0, (C)) +#endif #else #include #endif @@ -112,7 +114,7 @@ bool_t xdr_arrayN(xdrs, addrp, sizep, maxsize, elsize, elproc) if (target == NULL) { return (FALSE); } - bzero(target, (u_int)nodesize); + memset(target, 0, (u_int)nodesize); break; case XDR_FREE: diff --git a/src/rx/xdr_int64.c b/src/rx/xdr_int64.c index db49049..be60e72 100644 --- a/src/rx/xdr_int64.c +++ b/src/rx/xdr_int64.c @@ -11,7 +11,9 @@ RCSID("$Header$"); #if defined(KERNEL) && !defined(UKERNEL) #ifdef AFS_LINUX20_ENV #include "../h/string.h" +#if 0 #define bzero(A,C) memset((A), 0, (C)) +#endif #else #include #include diff --git a/src/rx/xdr_mem.c b/src/rx/xdr_mem.c index 1123529..0047b37 100644 --- a/src/rx/xdr_mem.c +++ b/src/rx/xdr_mem.c @@ -128,7 +128,7 @@ xdrmem_getbytes(xdrs, addr, len) if ((xdrs->x_handy -= len) < 0) return (FALSE); - bcopy(xdrs->x_private, addr, len); + memcpy(addr, xdrs->x_private, len); xdrs->x_private += len; return (TRUE); } @@ -142,7 +142,7 @@ xdrmem_putbytes(xdrs, addr, len) if ((xdrs->x_handy -= len) < 0) return (FALSE); - bcopy(addr, xdrs->x_private, len); + memcpy(xdrs->x_private, addr, len); xdrs->x_private += len; return (TRUE); } diff --git a/src/rx/xdr_rec.c b/src/rx/xdr_rec.c index 14f0845..1f1432c 100644 --- a/src/rx/xdr_rec.c +++ b/src/rx/xdr_rec.c @@ -269,7 +269,7 @@ xdrrec_putbytes(xdrs, addr, len) while (len > 0) { current = (u_int)rstrm->out_boundry - (u_int)rstrm->out_finger; current = (len < current) ? len : current; - bcopy(addr, rstrm->out_finger, current); + memcpy(rstrm->out_finger, addr, current); rstrm->out_finger += current; addr += current; len -= current; @@ -520,7 +520,7 @@ get_input_bytes(rstrm, addr, len) continue; } current = (len < current) ? len : current; - bcopy(rstrm->in_finger, addr, current); + memcpy(addr, rstrm->in_finger, current); rstrm->in_finger += current; addr += current; len -= current; diff --git a/src/rx/xdr_refernce.c b/src/rx/xdr_refernce.c index 7feaa0e..e938628 100644 --- a/src/rx/xdr_refernce.c +++ b/src/rx/xdr_refernce.c @@ -79,7 +79,7 @@ xdr_reference(xdrs, pp, size, proc) if (loc == NULL) { return (FALSE); } - bzero(loc, (int)size); + memset(loc, 0, (int)size); break; } diff --git a/src/rxgen/rpc_clntout.c b/src/rxgen/rpc_clntout.c index 24fe357..4a03f82 100644 --- a/src/rxgen/rpc_clntout.c +++ b/src/rxgen/rpc_clntout.c @@ -112,7 +112,7 @@ printbody(proc) } f_print(fout, "res;\n"); f_print(fout, "\n"); - f_print(fout, "\tbzero(%sres, sizeof(res));\n", ampr(proc->res_type)); + f_print(fout, "\tmemset(%sres, 0, sizeof(res));\n", ampr(proc->res_type)); f_print(fout, "\tif (clnt_call(clnt, %s, xdr_%s, argp, xdr_%s, %sres, TIMEOUT) != RPC_SUCCESS) {\n", proc->proc_name, stringfix(proc->arg_type), diff --git a/src/rxgen/rpc_main.c b/src/rxgen/rpc_main.c index 9885061..3c1fe95 100644 --- a/src/rxgen/rpc_main.c +++ b/src/rxgen/rpc_main.c @@ -201,7 +201,7 @@ main(argc, argv) OutFileFlag = NULL; S_output(cmd.infile, "-DRPC_SERVER", !EXTEND, cmd.outfile, 1); } else { - if (OutFileFlag && (rindex(OutFile,'.') == NULL)) + if (OutFileFlag && (strrchr(OutFile,'.') == NULL)) strcat(OutFile, "."); if (cmd.rflag) { C_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_CLIENT", EXTEND, ".cs.c", 1); @@ -286,11 +286,11 @@ extendfile(file, ext) if (res == NULL) { abort(); } - p = (char *) rindex(file, '.'); + p = (char *) strrchr(file, '.'); if (p == NULL) { p = file + strlen(file); } - sname = (char *) rindex(file,'/'); + sname = (char *) strrchr(file, '/'); if (sname == NULL) sname = file; else @@ -404,7 +404,7 @@ c_output(infile, define, extend, outfile, append) open_input(infile, define); cflag = 1; - bzero(fullname, sizeof(fullname)); + memset(fullname, 0, sizeof(fullname)); if (append) { strcpy(fullname, prefix); strcat(fullname, infile); @@ -516,7 +516,7 @@ h_output(infile, define, extend, outfile, append) open_input(infile, define); hflag = 1; - bzero(fullname, sizeof(fullname)); + memset(fullname, 0, sizeof(fullname)); if (append) { strcpy(fullname, prefix); strcat(fullname, infile); @@ -525,7 +525,7 @@ h_output(infile, define, extend, outfile, append) outfilename = extend ? extendfile(fullname, outfile) : outfile; open_output(infile, outfilename); strcpy(fullname, outfilename); - if (p = (char *)index(fullname, '.')) *p = '\0'; + if (p = strchr(fullname, '.')) *p = '\0'; f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n"); f_print(fout, "#ifndef _RXGEN_%s_\n", uppercase(fullname)); f_print(fout, "#define _RXGEN_%s_\n\n", uppercase(fullname)); @@ -728,7 +728,7 @@ int append; Cflag = 1; open_input(infile, define); - bzero(fullname, sizeof(fullname)); + memset(fullname, 0, sizeof(fullname)); if (append) { strcpy(fullname, prefix); strcat(fullname, infile); @@ -803,7 +803,7 @@ int append; Sflag = 1; open_input(infile, define); - bzero(fullname, sizeof(fullname)); + memset(fullname, 0, sizeof(fullname)); if (append) { strcpy(fullname, prefix); strcat(fullname, infile); @@ -902,7 +902,7 @@ parseargs(argc, argv, cmd) if (argc < 2) { return (0); } - bzero(flag, sizeof(flag)); + memset(flag, 0, sizeof(flag)); cmd->outfile = NULL; for (i = 1; i < argc; i++) { if (argv[i][0] != '-') { diff --git a/src/rxgen/rpc_parse.c b/src/rxgen/rpc_parse.c index c086323..b072ab1 100644 --- a/src/rxgen/rpc_parse.c +++ b/src/rxgen/rpc_parse.c @@ -148,7 +148,7 @@ get_definition() token tok; defp = ALLOC(definition); - bzero((char *)defp, sizeof(definition)); + memset((char *)defp, 0, sizeof(definition)); get_token(&tok); switch (tok.kind) { case TOK_STRUCT: @@ -882,7 +882,7 @@ token *tokp; do { get_token(tokp); Proc_list = ALLOC(proc1_list); - bzero((char *)Proc_list, sizeof(proc1_list)); + memset((char *)Proc_list, 0, sizeof(proc1_list)); Proc_list->pl.param_flag = 0; switch (tokp->kind) { case TOK_IN: @@ -904,7 +904,7 @@ token *tokp; *Proc_listp = Proc_list; Proc_listp = &Proc_list->next; decls = ALLOC(decl_list); - bzero((char *)decls, sizeof(decl_list)); + memset((char *)decls, 0, sizeof(decl_list)); decls->decl = dec; *tailp = decls; tailp = &decls->next; @@ -1172,7 +1172,7 @@ int split_flag; for (plist1 = defp->pc.plists; plist1; plist1 = plist1->next) { if ((plist1->component_kind == DEF_PARAM) && streq(plist->pl.param_type, plist1->pl.param_type) && !(plist1->pl.param_flag & PROCESSED_PARAM)) { char *star=""; - char *pntr = index(plist1->pl.param_type, '*'); + char *pntr = strchr(plist1->pl.param_type, '*'); if (pntr) star = "*"; if (plist1->pl.param_flag & OUT_STRING) { f_print(fout, ", *%s%s", star, plist1->pl.param_name); @@ -1399,11 +1399,11 @@ int *somefrees; for (plist = defp->pc.plists; plist; plist = plist->next) { if ((plist->component_kind == DEF_PARAM) && !(plist->pl.param_flag & PROCESSED_PARAM)) { if (plist->pl.param_flag & INDIRECT_PARAM) { - char pres, *pntr = index(plist->pl.param_type, '*'); + char pres, *pntr = strchr(plist->pl.param_type, '*'); if (pntr){ --pntr; pres = *pntr; *pntr = (char)0; } f_print(fout, "\t%s %s", plist->pl.param_type, plist->pl.param_name); *pntr = pres; - } else if (index(plist->pl.param_type, '*') == 0) { + } else if (strchr(plist->pl.param_type, '*') == 0) { f_print(fout, "\t%s %s", plist->pl.param_type, plist->pl.param_name); } else { plist->pl.param_flag |= FREETHIS_PARAM; @@ -1415,7 +1415,7 @@ int *somefrees; if ((plist1->component_kind == DEF_PARAM) && streq(plist->pl.param_type, plist1->pl.param_type) && !(plist1->pl.param_flag & PROCESSED_PARAM)) { if (plist1->pl.param_flag & INDIRECT_PARAM) { f_print(fout, ", %s", plist1->pl.param_name); - } else if (index(plist1->pl.param_type, '*') == 0) { + } else if (strchr(plist1->pl.param_type, '*') == 0) { f_print(fout, ", %s", plist1->pl.param_name); } else { plist1->pl.param_flag |= FREETHIS_PARAM; diff --git a/src/rxgen/rpc_svcout.c b/src/rxgen/rpc_svcout.c index 71c3a87..fa2fe01 100644 --- a/src/rxgen/rpc_svcout.c +++ b/src/rxgen/rpc_svcout.c @@ -231,7 +231,7 @@ write_program(def, storage) f_print(fout, "\t\treturn;\n"); f_print(fout, "\t}\n"); - f_print(fout, "\tbzero(&%s, sizeof(%s));\n", ARG, ARG); + f_print(fout, "\tmemset(&%s, 0, sizeof(%s));\n", ARG, ARG); printif("getargs", TRANSP, "&", ARG); printerr("decode", TRANSP); f_print(fout, "\t\treturn;\n"); diff --git a/src/rxgen/rpc_util.c b/src/rxgen/rpc_util.c index 579b514..9c2c960 100644 --- a/src/rxgen/rpc_util.c +++ b/src/rxgen/rpc_util.c @@ -72,7 +72,7 @@ static printwhere(); reinitialize() { int i; - bzero(curline, MAXLINESIZE); + memset(curline, 0, MAXLINESIZE); where = curline; linenum = 0; defined = NULL; diff --git a/src/rxkad/domestic/crypt_conn.c b/src/rxkad/domestic/crypt_conn.c index e33dbd7..7723bb9 100644 --- a/src/rxkad/domestic/crypt_conn.c +++ b/src/rxkad/domestic/crypt_conn.c @@ -63,7 +63,7 @@ afs_int32 rxkad_DecryptPacket (conn, schedule, ivec, len, packet) rxkad_stats.bytesDecrypted[rxkad_TypeIndex(tp->type)] += len; UNLOCK_RXKAD_STATS - bcopy ((void *)ivec, (void *)xor, sizeof(xor)); + memcpy((void *)xor, (void *)ivec, sizeof(xor)); for (i = 0; len ; i++) { data = rx_data(packet, i, tlen); if (!data || !tlen) @@ -106,7 +106,7 @@ afs_int32 rxkad_EncryptPacket (conn, schedule, ivec, len, packet) */ rx_PutInt32(packet, 1*sizeof(afs_int32), 0); - bcopy ((void *)ivec, (void *)xor, sizeof(xor)); + memcpy((void *)xor, (void *)ivec, sizeof(xor)); for (i = 0; len ; i++) { data = rx_data(packet, i, tlen); if (!data || !tlen) diff --git a/src/rxkad/domestic/fcrypt.c b/src/rxkad/domestic/fcrypt.c index e78374b..2ae320c 100644 --- a/src/rxkad/domestic/fcrypt.c +++ b/src/rxkad/domestic/fcrypt.c @@ -130,8 +130,8 @@ afs_int32 fc_ecb_encrypt(clear, cipher, schedule, encrypt) #endif #if 0 - bcopy (clear, &L, sizeof(afs_int32)); - bcopy (clear+1, &R, sizeof(afs_int32)); + memcpy(&L, clear, sizeof(afs_int32)); + memcpy(&R, clear+1, sizeof(afs_int32)); #else L = ntohl(*clear); R = ntohl(*(clear+1)); @@ -181,8 +181,8 @@ afs_int32 fc_ecb_encrypt(clear, cipher, schedule, encrypt) } } #if 0 - bcopy (&L, cipher, sizeof(afs_int32)); - bcopy (&R, cipher+1, sizeof(afs_int32)); + memcpy(cipher, &L, sizeof(afs_int32)); + memcpy(cipher+1, &R, sizeof(afs_int32)); #else *cipher = htonl(L); *(cipher+1) = htonl(R); @@ -210,7 +210,7 @@ afs_int32 fc_cbc_encrypt (input, output, length, key, xor, encrypt) if (encrypt) { for (i = 0; length > 0; i++, length -= 8) { /* get input */ - bcopy (input, t_input, sizeof(t_input)); + memcpy(t_input, input, sizeof(t_input)); input += sizeof(t_input); /* zero pad */ @@ -224,7 +224,7 @@ afs_int32 fc_cbc_encrypt (input, output, length, key, xor, encrypt) fc_ecb_encrypt (xor, t_output, key, encrypt); /* copy temp output and save it for cbc */ - bcopy (t_output, output, sizeof(t_output)); + memcpy(output, t_output, sizeof(t_output)); output += sizeof(t_output); /* calculate xor value for next round from plain & cipher text */ @@ -240,7 +240,7 @@ afs_int32 fc_cbc_encrypt (input, output, length, key, xor, encrypt) /* decrypt */ for (i = 0; length > 0; i++, length -= 8) { /* get input */ - bcopy (input, t_input, sizeof(t_input)); + memcpy(t_input, input, sizeof(t_input)); input += sizeof(t_input); /* no padding for decrypt */ @@ -251,7 +251,7 @@ afs_int32 fc_cbc_encrypt (input, output, length, key, xor, encrypt) t_output[1] ^= xor[1] ; /* copy temp output */ - bcopy (t_output, output, sizeof(t_output)); + memcpy(output, t_output, sizeof(t_output)); output += sizeof(t_output); /* calculate xor value for next round from plain & cipher text */ diff --git a/src/rxkad/domestic/tcrypt.c b/src/rxkad/domestic/tcrypt.c index 75472cc..e952272 100644 --- a/src/rxkad/domestic/tcrypt.c +++ b/src/rxkad/domestic/tcrypt.c @@ -101,14 +101,14 @@ int main (argc, argv) afs_uint32 xor[2]; for (i=0; i<10; i++) msg[i]=htonl(i); - bcopy ("abcdefgh", &key, sizeof(struct ktc_encryptionKey)); + memcpy(&key, "abcdefgh", sizeof(struct ktc_encryptionKey)); fc_keysched (&key, schedule); print_msg ("Starting msg is:", msg, sizeof(msg)); - bcopy(&key, xor, 2*sizeof(afs_int32)); + memcpy(xor, &key, 2*sizeof(afs_int32)); fc_cbc_encrypt (msg, out, sizeof(msg), schedule, &key, ENCRYPT); - bcopy(&key, xor, 2*sizeof(afs_int32)); + memcpy(xor, &key, 2*sizeof(afs_int32)); fc_cbc_encrypt (out, dec, sizeof(msg), schedule, &key, DECRYPT); - if (bcmp (msg, dec, sizeof(msg)) != 0) + if (memcmp (msg, dec, sizeof(msg)) != 0) printf ("Encryption FAILED!\n"); print_msg ("Encrypted is:", out, sizeof(out)); print_msg ("Decrypted is:", dec, sizeof(dec)); @@ -120,7 +120,7 @@ int main (argc, argv) #endif e[0] = 0x11111111; e[1] = 0xaaaaaaaa; - bcopy ("abcdefgh", &key, sizeof(struct ktc_encryptionKey)); + memcpy(&key, "abcdefgh", sizeof(struct ktc_encryptionKey)); for (rounds=2; rounds<=MAXROUNDS; rounds +=2) { #ifdef TCRYPT ROUNDS = rounds; diff --git a/src/rxkad/rxkad_client.c b/src/rxkad/rxkad_client.c index 848608a..12dd079 100644 --- a/src/rxkad/rxkad_client.c +++ b/src/rxkad/rxkad_client.c @@ -130,15 +130,14 @@ rxkad_AllocCID(aobj, aconn) if (aobj) { /* block is ready for encryption with session key, let's go for it. */ tcp = (struct rxkad_cprivate *) aobj->privateData; - bcopy((void *)tcp->ivec, (void *)xor, 2*sizeof(afs_int32)); + memcpy((void *)xor, (void *)tcp->ivec, 2*sizeof(afs_int32)); fc_cbc_encrypt((char *) &tgen, (char *) &tgen, sizeof(tgen), tcp->keysched, xor, ENCRYPT); } else { /* Create a session key so that we can encrypt it */ } - bcopy(((char *)&tgen) + sizeof(tgen) - ENCRYPTIONBLOCKSIZE, - (void *)Cuid, ENCRYPTIONBLOCKSIZE); + memcpy((void *)Cuid, ((char *)&tgen) + sizeof(tgen) - ENCRYPTIONBLOCKSIZE, ENCRYPTIONBLOCKSIZE); Cuid[0] = (Cuid[0] & ~0x40000000) | 0x80000000; Cuid[1] &= RX_CIDMASK; rx_SetEpoch (Cuid[0]); /* for future rxnull connections */ @@ -174,22 +173,22 @@ rxkad_NewClientSecurityObject(level, sessionkey, kvno, ticketLen, ticket) size = sizeof(struct rx_securityClass); tsc = (struct rx_securityClass *) rxi_Alloc (size); - bzero ((void *)tsc, size); + memset((void *)tsc, 0, size); tsc->refCount = 1; /* caller gets one for free */ tsc->ops = &rxkad_client_ops; size = sizeof(struct rxkad_cprivate); tcp = (struct rxkad_cprivate *) rxi_Alloc (size); - bzero ((void *)tcp, size); + memset((void *)tcp, 0, size); tsc->privateData = (char *) tcp; tcp->type |= rxkad_client; tcp->level = level; code = fc_keysched (sessionkey, tcp->keysched); if (code) return 0; /* bad key */ - bcopy ((void *)sessionkey, (void *)tcp->ivec, sizeof(tcp->ivec)); + memcpy((void *)tcp->ivec, (void *)sessionkey, sizeof(tcp->ivec)); tcp->kvno = kvno; /* key version number */ tcp->ticketLen = ticketLen; /* length of ticket */ - bcopy(ticket, tcp->ticket, ticketLen); + memcpy(tcp->ticket, ticket, ticketLen); LOCK_RXKAD_STATS rxkad_stats_clientObjects++; @@ -244,7 +243,7 @@ rxs_return_t rxkad_GetResponse (aobj, aconn, apacket) if (v2) { int i; afs_uint32 xor[2]; - bzero ((void *)&r_v2, sizeof(r_v2)); + memset((void *)&r_v2, 0, sizeof(r_v2)); r_v2.version = htonl(RXKAD_CHALLENGE_PROTOCOL_VERSION); r_v2.spare = 0; (void) rxkad_SetupEndpoint (aconn, &r_v2.encrypted.endpoint); @@ -258,13 +257,13 @@ rxs_return_t rxkad_GetResponse (aobj, aconn, apacket) r_v2.kvno = htonl(tcp->kvno); r_v2.ticketLen = htonl(tcp->ticketLen); r_v2.encrypted.endpoint.cksum = rxkad_CksumChallengeResponse (&r_v2); - bcopy((void *)tcp->ivec, (void *)xor, 2*sizeof(afs_int32)); + memcpy((void *)xor, (void *)tcp->ivec, 2*sizeof(afs_int32)); fc_cbc_encrypt (&r_v2.encrypted, &r_v2.encrypted, sizeof(r_v2.encrypted), tcp->keysched, xor, ENCRYPT); response = (char *)&r_v2; responseSize = sizeof(r_v2); } else { - bzero ((void *)&r_old, sizeof(r_old)); + memset((void *)&r_old, 0, sizeof(r_old)); r_old.encrypted.incChallengeID = htonl(challengeID + 1); r_old.encrypted.level = htonl((afs_int32)tcp->level); r_old.kvno = htonl(tcp->kvno); diff --git a/src/rxkad/rxkad_common.c b/src/rxkad/rxkad_common.c index 5e7a8fd..31c6579 100644 --- a/src/rxkad/rxkad_common.c +++ b/src/rxkad/rxkad_common.c @@ -96,11 +96,10 @@ rxkad_DeriveXORInfo(aconnp, aschedule, aivec, aresult) afs_uint32 xor[2]; rxkad_SetupEndpoint(aconnp, &tendpoint); - bcopy(aivec, (void *)xor, 2*sizeof(afs_int32)); + memcpy((void *)xor, aivec, 2*sizeof(afs_int32)); fc_cbc_encrypt(&tendpoint, &tendpoint, sizeof(tendpoint), aschedule, xor, ENCRYPT); - bcopy(((char *)&tendpoint) + sizeof(tendpoint) - ENCRYPTIONBLOCKSIZE, - aresult, ENCRYPTIONBLOCKSIZE); + memcpy(aresult, ((char *)&tendpoint) + sizeof(tendpoint) - ENCRYPTIONBLOCKSIZE, ENCRYPTIONBLOCKSIZE); return 0; } @@ -215,7 +214,7 @@ rxs_return_t rxkad_NewConnection (aobj, aconn) if (rx_IsServerConn(aconn)) { int size = sizeof(struct rxkad_sconn); aconn->securityData = (char *) rxi_Alloc (size); - bzero(aconn->securityData, size); /* initialize it conveniently */ + memset(aconn->securityData, 0, size); /* initialize it conveniently */ } else { /* client */ struct rxkad_cprivate *tcp; @@ -223,7 +222,7 @@ rxs_return_t rxkad_NewConnection (aobj, aconn) int size = sizeof(struct rxkad_cconn); tccp = (struct rxkad_cconn *) rxi_Alloc (size); aconn->securityData = (char *) tccp; - bzero(aconn->securityData, size); /* initialize it conveniently */ + memset(aconn->securityData, 0, size); /* initialize it conveniently */ tcp = (struct rxkad_cprivate *) aobj->privateData; if (!(tcp->type & rxkad_client)) return RXKADINCONSISTENCY; rxkad_SetLevel(aconn, tcp->level); /* set header and trailer sizes */ diff --git a/src/rxkad/rxkad_server.c b/src/rxkad/rxkad_server.c index fdde03e..d3908d1 100644 --- a/src/rxkad/rxkad_server.c +++ b/src/rxkad/rxkad_server.c @@ -120,12 +120,12 @@ rxkad_NewServerSecurityObject (level, get_key_rock, get_key, user_ok) size = sizeof(struct rx_securityClass); tsc = (struct rx_securityClass *) osi_Alloc (size); - bzero (tsc, size); + memset(tsc, 0, size); tsc->refCount = 1; /* caller has one reference */ tsc->ops = &rxkad_server_ops; size = sizeof(struct rxkad_sprivate); tsp = (struct rxkad_sprivate *) osi_Alloc (size); - bzero (tsp, size); + memset(tsp, 0, size); tsc->privateData = (char *) tsp; tsp->type |= rxkad_server; /* so can identify later */ @@ -190,7 +190,7 @@ rxs_return_t rxkad_GetChallenge (aobj, aconn, apacket) if (rx_IsUsingPktCksum(aconn)) sconn->cksumSeen = 1; if (sconn->cksumSeen) { - bzero (&c_v2, sizeof(c_v2)); + memset(&c_v2, 0, sizeof(c_v2)); c_v2.version = htonl(RXKAD_CHALLENGE_PROTOCOL_VERSION); c_v2.challengeID = htonl(sconn->challengeID); c_v2.level = htonl((afs_int32)sconn->level); @@ -198,7 +198,7 @@ rxs_return_t rxkad_GetChallenge (aobj, aconn, apacket) challenge = (char *)&c_v2; challengeSize = sizeof(c_v2); } else { - bzero (&c_old, sizeof(c_old)); + memset(&c_old, 0, sizeof(c_old)); c_old.challengeID = htonl(sconn->challengeID); c_old.level = htonl((afs_int32)sconn->level); challenge = (char *)&c_old; @@ -313,7 +313,7 @@ rxs_return_t rxkad_CheckResponse (aobj, aconn, apacket) code = fc_keysched (&sessionkey, sconn->keysched); if (code) return RXKADBADKEY; - bcopy (&sessionkey, sconn->ivec, sizeof(sconn->ivec)); + memcpy(sconn->ivec, &sessionkey, sizeof(sconn->ivec)); if (sconn->cksumSeen) { /* using v2 response */ @@ -322,7 +322,7 @@ rxs_return_t rxkad_CheckResponse (aobj, aconn, apacket) int i; afs_uint32 xor[2]; - bcopy(sconn->ivec, xor, 2*sizeof(afs_int32)); + memcpy(xor, sconn->ivec, 2*sizeof(afs_int32)); fc_cbc_encrypt (&v2r.encrypted, &v2r.encrypted, sizeof(v2r.encrypted), sconn->keysched, xor, DECRYPT); cksum = rxkad_CksumChallengeResponse (&v2r); @@ -330,7 +330,7 @@ rxs_return_t rxkad_CheckResponse (aobj, aconn, apacket) return RXKADSEALEDINCON; (void) rxkad_SetupEndpoint (aconn, &endpoint); v2r.encrypted.endpoint.cksum = 0; - if (bcmp (&endpoint, &v2r.encrypted.endpoint, sizeof(endpoint)) != 0) + if (memcmp (&endpoint, &v2r.encrypted.endpoint, sizeof(endpoint)) != 0) return RXKADSEALEDINCON; for (i=0; ikvno = kvno; - bcopy (&client, &rock->client, sizeof(rock->client)); + memcpy(&rock->client, &client, sizeof(rock->client)); sconn->rock = rock; } return 0; diff --git a/src/rxkad/test/stress.c b/src/rxkad/test/stress.c index ec5fa13..3491765 100644 --- a/src/rxkad/test/stress.c +++ b/src/rxkad/test/stress.c @@ -105,8 +105,8 @@ static int CommandProc (as, arock) sParms = (struct serverParms *) osi_Alloc (sizeof(*sParms)); cParms = (struct clientParms *) osi_Alloc (sizeof(*cParms)); - bzero (sParms, sizeof(*sParms)); - bzero (cParms, sizeof(*cParms)); + memset(sParms, 0, sizeof(*sParms)); + memset(cParms, 0, sizeof(*cParms)); sParms->whoami = cParms->whoami = whoami; if (!(startServer || startClient)) { diff --git a/src/rxkad/test/stress_c.c b/src/rxkad/test/stress_c.c index f9a476a..6ca0863 100644 --- a/src/rxkad/test/stress_c.c +++ b/src/rxkad/test/stress_c.c @@ -48,7 +48,7 @@ static long GetServer(aname) fprintf (stderr, "host %s not found\n", aname); return errno; } - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); return addr; } @@ -252,7 +252,7 @@ static long CallSimultaneously (threads, rock, proc) #endif assert (i < MAX_CTHREADS); w = (struct worker *) osi_Alloc (sizeof(struct worker)); - bzero (w, sizeof(*w)); + memset(w, 0, sizeof(*w)); w->next = workers; workers = w; w->index = i; @@ -353,7 +353,7 @@ static long RunLoadTest (parms, conn) DivideUpCalls (parms->slowCalls, parms->threads, slowCalls); DivideUpCalls (parms->copiousCalls, parms->threads, copiousCalls); - bzero (&c, sizeof(c)); + memset(&c, 0, sizeof(c)); c.conn = conn; c.sendLen = parms->sendLen; c.recvLen = parms->recvLen; @@ -519,7 +519,7 @@ static long MakeMultiChannelCall (conn, each, expectedCode, codes) int i; struct multiChannel mc; - bzero (&mc, sizeof(mc)); + memset(&mc, 0, sizeof(mc)); mc.conn = conn; for (i=0; iskt), sizeof(struct sockaddr_in)); + memcpy((char *)&(a_line->skt), (char *)a_skt, sizeof(struct sockaddr_in)); a_line->numDisks = 0; a_line->base_line = a_lineNum + scout_screen.base_line_num; a_line->num_lines = 1; @@ -1752,7 +1752,7 @@ static int execute_scout(a_numservers, a_srvname, a_pkg) rn, a_numservers, sktbytes); scout_CleanExit(-1); } - bzero(FSSktArray, sktbytes); + memset(FSSktArray, 0, sktbytes); /* * Sweep through the server names provided, filling in the socket @@ -1772,7 +1772,7 @@ static int execute_scout(a_numservers, a_srvname, a_pkg) rn, fullsrvname); return(-1); } - bcopy(he->h_addr, &(curr_skt->sin_addr.s_addr), 4); + memcpy(&(curr_skt->sin_addr.s_addr), he->h_addr, 4); curr_skt->sin_family = htons(AF_INET); /*Internet family*/ curr_skt->sin_port = htons(7000); /*FileServer port*/ @@ -1794,7 +1794,7 @@ static int execute_scout(a_numservers, a_srvname, a_pkg) rn, mini_line_bytes, a_numservers); return(-1); } - bzero(mini_lines, mini_line_bytes); + memset(mini_lines, 0, mini_line_bytes); /* * Set up each line in the mini_lines, creating and initializing diff --git a/src/sys/rmtsysc.c b/src/sys/rmtsysc.c index e114d44..ba003f2 100644 --- a/src/sys/rmtsysc.c +++ b/src/sys/rmtsysc.c @@ -107,7 +107,7 @@ char *syscall; printf("host %s not found; %s call aborted\n", afs_server, syscall); return 0; } - bcopy(th->h_addr, &hostAddr, sizeof(hostAddr)); + memcpy(&hostAddr, th->h_addr, sizeof(hostAddr)); return hostAddr; } @@ -229,7 +229,7 @@ struct ViceIoctl *data; if (!(inbuffer = (char *)malloc(ins))) return (-1); /* helpless here */ if (data->in_size) - bcopy(data->in, inbuffer, data->in_size); + memcpy(inbuffer, data->in, data->in_size); InData.rmtbulk_len = data->in_size; InData.rmtbulk_val = inbuffer; inparam_conversion(cmd, InData.rmtbulk_val, 0); diff --git a/src/sys/rmtsyss.c b/src/sys/rmtsyss.c index e1026df..2657b6a 100644 --- a/src/sys/rmtsyss.c +++ b/src/sys/rmtsyss.c @@ -134,9 +134,9 @@ rmtbulk *InData, *OutData; data.in = (char *)malloc(InData->rmtbulk_len + PIOCTL_HEADER*sizeof(afs_int32)); if (!data.in) return (-1); /* helpless here */ if (!strcmp(path, NIL_PATHP)) pathp = (char *)0; /* It meant to be NIL */ - bcopy(blob, data.in, sizeof(blob)); + memcpy(data.in, blob, sizeof(blob)); inparam_conversion(cmd, InData->rmtbulk_val, 1); - bcopy(InData->rmtbulk_val, data.in+sizeof(blob), InData->rmtbulk_len); + memcpy(data.in+sizeof(blob), InData->rmtbulk_val, InData->rmtbulk_len); data.in_size = InData->rmtbulk_len + PIOCTL_HEADER*sizeof(afs_int32); data.out = OutData->rmtbulk_val; data.out_size = OutData->rmtbulk_len; diff --git a/src/tsm41/aix41_auth.c b/src/tsm41/aix41_auth.c index e8e4296..ea57140 100644 --- a/src/tsm41/aix41_auth.c +++ b/src/tsm41/aix41_auth.c @@ -107,7 +107,7 @@ int afs_initialize(struct secmethod_table *meths) { * each time we call the authenticate routine. */ ka_Init(0); - bzero(meths, sizeof(struct secmethod_table)); + memset(meths, 0, sizeof(struct secmethod_table)); /* * Initialize the exported interface routines. Except the authenticate one * the others are currently mainly noops. diff --git a/src/ubik/beacon.c b/src/ubik/beacon.c index c3c6f38..ed18876 100644 --- a/src/ubik/beacon.c +++ b/src/ubik/beacon.c @@ -201,7 +201,7 @@ ubeacon_InitServerListCommon(ame, info, clones, aservers) for (i = 0; i < info->numServers; i++) { if (i == me) continue; ts = (struct ubik_server *) malloc(sizeof(struct ubik_server)); - bzero(ts, sizeof(struct ubik_server)); + memset(ts, 0, sizeof(struct ubik_server)); ts->next = ubik_servers; ubik_servers = ts; ts->addr[0] = info->hostAddr[i].sin_addr.s_addr; @@ -232,7 +232,7 @@ ubeacon_InitServerListCommon(ame, info, clones, aservers) while (servAddr = *aservers++) { if (i >= MAXSERVERS) return UNHOSTS; /* too many hosts */ ts = (struct ubik_server *) malloc(sizeof(struct ubik_server)); - bzero(ts, sizeof(struct ubik_server)); + memset(ts, 0, sizeof(struct ubik_server)); ts->next = ubik_servers; ubik_servers = ts; ts->addr[0] = servAddr; /* primary address in net byte order */ diff --git a/src/ubik/disk.c b/src/ubik/disk.c index b174cd5..e35dce4 100644 --- a/src/ubik/disk.c +++ b/src/ubik/disk.c @@ -80,7 +80,7 @@ udisk_Debug(aparm) struct buffer *tb; int i; - bcopy(&ubik_dbase->version, &aparm->localVersion, sizeof(struct ubik_version)); + memcpy(&aparm->localVersion, &ubik_dbase->version, sizeof(struct ubik_version)); aparm->lockedPages = 0; aparm->writeLockedPages = 0; tb = Buffers; @@ -217,7 +217,7 @@ static int DInit (abuffers) int i; struct buffer *tb; Buffers = (struct buffer *) malloc(abuffers * sizeof(struct buffer)); - bzero(Buffers, abuffers * sizeof(struct buffer)); + memset(Buffers, 0, abuffers * sizeof(struct buffer)); BufferData = (char *) malloc(abuffers * PAGESIZE); nbuffers = abuffers; for(i=0;idata, PAGESIZE); + memset(tb->data, 0, PAGESIZE); tb->lockers++; code = (*dbase->read)(dbase, fid, tb->data, page*PAGESIZE, PAGESIZE); @@ -558,7 +558,7 @@ static char *DNew (dbase, fid, page) if ((tb = newslot(dbase, fid, page)) == 0) return (char *) 0; tb->lockers++; - bzero(tb->data, PAGESIZE); + memset(tb->data, 0, PAGESIZE); return tb->data; } @@ -582,7 +582,7 @@ udisk_read(atrans, afile, abuffer, apos, alen) offset = apos & (PAGESIZE-1); len = PAGESIZE - offset; if (len > alen) len = alen; - bcopy(bp+offset, abuffer, len); + memcpy(abuffer, bp+offset, len); abuffer += len; apos += len; alen -= len; @@ -658,13 +658,13 @@ udisk_write(atrans, afile, abuffer, apos, alen) if (!bp) { bp = DNew(dbase, afile, apos>>LOGPAGESIZE); if (!bp) return UIOERROR; - bzero(bp, PAGESIZE); + memset(bp, 0, PAGESIZE); } /* otherwise, min of remaining bytes and end of buffer to user mode */ offset = apos & (PAGESIZE-1); len = PAGESIZE-offset; if (len > alen) len = alen; - bcopy(abuffer, bp+offset, len); + memcpy(bp+offset, abuffer, len); abuffer += len; apos += len; alen -= len; @@ -694,7 +694,7 @@ udisk_begin(adbase, atype, atrans) if (code) return code; } tt = (struct ubik_trans *) malloc(sizeof(struct ubik_trans)); - bzero(tt, sizeof(struct ubik_trans)); + memset(tt, 0, sizeof(struct ubik_trans)); tt->dbase = adbase; tt->next = adbase->activeTrans; adbase->activeTrans = tt; diff --git a/src/ubik/recovery.c b/src/ubik/recovery.c index 4fd0e20..b5d6409 100644 --- a/src/ubik/recovery.c +++ b/src/ubik/recovery.c @@ -530,7 +530,7 @@ FetchEndCall: if (!code) { /* we got a new file, set up its header */ urecovery_state |= UBIK_RECHAVEDB; - bcopy(&tversion, &ubik_dbase->version, sizeof(struct ubik_version)); + memcpy(&ubik_dbase->version, &tversion, sizeof(struct ubik_version)); (*ubik_dbase->sync)(ubik_dbase, 0); /* get data out first */ /* after data is good, sync disk with correct label */ code = (*ubik_dbase->setlabel)(ubik_dbase, 0, &ubik_dbase->version); diff --git a/src/ubik/remote.c b/src/ubik/remote.c index 33b7af5..c09508d 100644 --- a/src/ubik/remote.c +++ b/src/ubik/remote.c @@ -522,7 +522,7 @@ SDISK_SendFile(rxcall, file, length, avers) This way, good label is only on good database. */ (*ubik_dbase->sync)(dbase, file); code = (*ubik_dbase->setlabel)(dbase, file, avers); - bcopy(avers, &ubik_dbase->version, sizeof(struct ubik_version)); + memcpy(&ubik_dbase->version, avers, sizeof(struct ubik_version)); udisk_Invalidate(dbase, file); /* new dbase, flush disk buffers */ LWP_NoYieldSignal(&dbase->version); DBRELE(dbase); diff --git a/src/ubik/ubik.c b/src/ubik/ubik.c index 6e985ae..4c37f83 100644 --- a/src/ubik/ubik.c +++ b/src/ubik/ubik.c @@ -222,8 +222,8 @@ int ubik_ServerInitCommon(myHost, myPort, info, clones, serverList, pathName, db tdb->pathName = (char *) malloc(strlen(pathName)+1); strcpy(tdb->pathName, pathName); tdb->activeTrans = (struct ubik_trans *) 0; - bzero(&tdb->version, sizeof(struct ubik_version)); - bzero(&tdb->cachedVersion, sizeof(struct ubik_version)); + memset(&tdb->version, 0, sizeof(struct ubik_version)); + memset(&tdb->cachedVersion, 0, sizeof(struct ubik_version)); Lock_Init(&tdb->versionLock); tdb->flags = 0; tdb->read = uphys_read; @@ -399,7 +399,7 @@ int ubik_AbortTrans(transPtr) dbase = transPtr->dbase; DBHOLD(dbase); - bzero(&dbase->cachedVersion, sizeof(struct ubik_version)); + memset(&dbase->cachedVersion, 0, sizeof(struct ubik_version)); /* see if we're still up-to-date */ if (!urecovery_AllBetter(dbase, transPtr->flags & TRREADANY)) { udisk_abort(transPtr); @@ -451,7 +451,7 @@ int ubik_EndTrans(transPtr) dbase = transPtr->dbase; DBHOLD(dbase); - bzero(&dbase->cachedVersion, sizeof(struct ubik_version)); + memset(&dbase->cachedVersion, 0, sizeof(struct ubik_version)); /* give up if no longer current */ if (!urecovery_AllBetter(dbase, transPtr->flags & TRREADANY)) { @@ -530,7 +530,7 @@ int ubik_EndTrans(transPtr) success: udisk_end(transPtr); /* update version on successful EndTrans */ - bcopy(&dbase->version, &dbase->cachedVersion, sizeof(struct ubik_version)); + memcpy(&dbase->cachedVersion, &dbase->version, sizeof(struct ubik_version)); DBRELE(dbase); return 0; @@ -667,9 +667,7 @@ int ubik_Write(transPtr, buffer, length) iovec[transPtr->iovec_info.iovec_wrt_len].position = transPtr->seekPos; iovec[transPtr->iovec_info.iovec_wrt_len].length = length; - bcopy(buffer, - &transPtr->iovec_data.iovec_buf_val[transPtr->iovec_data.iovec_buf_len], - length); + memcpy(&transPtr->iovec_data.iovec_buf_val[transPtr->iovec_data.iovec_buf_len], buffer, length); transPtr->iovec_info.iovec_wrt_len++; transPtr->iovec_data.iovec_buf_len += length; diff --git a/src/ubik/ubikcmd.c b/src/ubik/ubikcmd.c index 882d579..0aad08a 100644 --- a/src/ubik/ubikcmd.c +++ b/src/ubik/ubikcmd.c @@ -48,7 +48,7 @@ ubik_ParseServerList(argc, argv, ahost, aothers) gethostname(hostname, sizeof(hostname)); th = gethostbyname(hostname); if (!th) return UBADHOST; - bcopy(th->h_addr, &myHost, sizeof(afs_int32)); + memcpy(&myHost, th->h_addr, sizeof(afs_int32)); *ahost = myHost; inServer = 0; /* haven't seen -servers yet */ @@ -66,7 +66,7 @@ ubik_ParseServerList(argc, argv, ahost, aothers) /* otherwise this is a new host name */ th = gethostbyname(tp); if (!th) return UBADHOST; - bcopy(th->h_addr, &temp, sizeof(afs_int32)); + memcpy(&temp, th->h_addr, sizeof(afs_int32)); if (temp != myHost) { if (counter++ >= MAXSERVERS) return UNHOSTS; *aothers++ = temp; diff --git a/src/ubik/udebug.c b/src/ubik/udebug.c index 2e27e41..272c850 100644 --- a/src/ubik/udebug.c +++ b/src/ubik/udebug.c @@ -121,7 +121,7 @@ struct cmd_syndesc *as; { printf("udebug: host %s not found in host table\n", hostName); exit(1); } - bcopy(th->h_addr, &hostAddr, sizeof(afs_int32)); + memcpy(&hostAddr, th->h_addr, sizeof(afs_int32)); } else hostAddr = htonl(0x7f000001); /* IP localhost */ diff --git a/src/ubik/vote.c b/src/ubik/vote.c index 6230473..abe9e8f 100644 --- a/src/ubik/vote.c +++ b/src/ubik/vote.c @@ -343,7 +343,7 @@ SVOTE_XSDebug(rxcall, awhich, aparm, isclone) aparm->altAddr[i] = ntohl(ts->addr[i+1]); aparm->lastVoteTime = ts->lastVoteTime; aparm->lastBeaconSent = ts->lastBeaconSent; - bcopy(&ts->version, &aparm->remoteVersion, sizeof(struct ubik_version)); + memcpy(&aparm->remoteVersion, &ts->version, sizeof(struct ubik_version)); aparm->lastVote = ts->lastVote; aparm->up = ts->up; aparm->beaconSinceDown = ts->beaconSinceDown; @@ -406,8 +406,8 @@ SVOTE_Debug(rxcall, aparm) (urecovery_state & UBIK_RECHAVEDB ) ) { aparm->recoveryState |= UBIK_RECLABELDB; } - bcopy(&ubik_dbVersion, &aparm->syncVersion, sizeof(struct ubik_version)); - bcopy(&ubik_dbTid, &aparm->syncTid, sizeof(struct ubik_tid)); + memcpy(&aparm->syncVersion, &ubik_dbVersion, sizeof(struct ubik_version)); + memcpy(&aparm->syncTid, &ubik_dbTid, sizeof(struct ubik_tid)); aparm->activeWrite = (ubik_dbase->flags & DBWRITING); aparm->tidCounter = ubik_dbase->tidCounter; @@ -437,7 +437,7 @@ SVOTE_SDebugOld(rxcall, awhich, aparm) aparm->addr = ntohl(ts->addr[0]); /* primary interface */ aparm->lastVoteTime = ts->lastVoteTime; aparm->lastBeaconSent = ts->lastBeaconSent; - bcopy(&ts->version, &aparm->remoteVersion, sizeof(struct ubik_version)); + memcpy(&aparm->remoteVersion, &ts->version, sizeof(struct ubik_version)); aparm->lastVote = ts->lastVote; aparm->up = ts->up; aparm->beaconSinceDown = ts->beaconSinceDown; @@ -484,8 +484,8 @@ SVOTE_DebugOld(rxcall, aparm) (urecovery_state & UBIK_RECHAVEDB ) ) { aparm->recoveryState |= UBIK_RECLABELDB; } - bcopy(&ubik_dbVersion, &aparm->syncVersion, sizeof(struct ubik_version)); - bcopy(&ubik_dbTid, &aparm->syncTid, sizeof(struct ubik_tid)); + memcpy(&aparm->syncVersion, &ubik_dbVersion, sizeof(struct ubik_version)); + memcpy(&aparm->syncTid, &ubik_dbTid, sizeof(struct ubik_tid)); aparm->activeWrite = (ubik_dbase->flags & DBWRITING); aparm->tidCounter = ubik_dbase->tidCounter; diff --git a/src/update/client.c b/src/update/client.c index 978b0fc..abd0215 100644 --- a/src/update/client.c +++ b/src/update/client.c @@ -77,7 +77,7 @@ char *aname; { printf("host %s not found \n", aname); exit(1); } - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); return addr; } diff --git a/src/usd/usd_file.c b/src/usd/usd_file.c index 35e3f9d..020f3a1 100644 --- a/src/usd/usd_file.c +++ b/src/usd/usd_file.c @@ -357,7 +357,7 @@ static int usd_FileOpen( return errno; usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); usd->handle = (void *)fd; usd->read = usd_FileRead; usd->write = usd_FileWrite; @@ -427,7 +427,7 @@ static int usd_FileStandardInput( *usdP = NULL; usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); usd->handle = (void *)((unsigned long)0); usd->read = usd_FileRead; usd->write = usd_FileWrite; @@ -455,7 +455,7 @@ static int usd_FileStandardOutput( *usdP = NULL; usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); usd->handle = (void *)((unsigned long)1); usd->read = usd_FileRead; usd->write = usd_FileWrite; diff --git a/src/usd/usd_nt.c b/src/usd/usd_nt.c index 5be2199..92eadb0 100644 --- a/src/usd/usd_nt.c +++ b/src/usd/usd_nt.c @@ -485,7 +485,7 @@ static int usd_DeviceOpen( return nterr_nt2unix(GetLastError(), EIO); usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); _ASSERT(sizeof(devhandle) <= sizeof(usd->handle)); @@ -541,7 +541,7 @@ static int usd_DeviceStandardInput(usd_handle_t *usdP) *usdP = NULL; usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); usd->handle = (void *)0; usd->read = usd_DeviceRead; usd->write = usd_DeviceWrite; @@ -568,7 +568,7 @@ static int usd_DeviceStandardOutput( *usdP = NULL; usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); usd->handle = (void *)1; usd->read = usd_DeviceRead; usd->write = usd_DeviceWrite; diff --git a/src/uss/lex.c b/src/uss/lex.c index 720e369..038b438 100644 --- a/src/uss/lex.c +++ b/src/uss/lex.c @@ -15,7 +15,6 @@ RCSID("$Header$"); #include "y.tab.h" #include "uss_common.h" -extern char *index(); int line=1; #ifdef DEBUG #define dprint(x) {fprintf(stderr, x); fflush(stderr);} @@ -92,7 +91,7 @@ Replace(in, out) } out_cp = out; - while ((in_var = index(in_text, '$')) != NULL) { + while ((in_var = strchr(in_text, '$')) != NULL) { while(in_text < in_var) *out_cp++ = *in_text++; VarNo = *(in_var+1); @@ -185,7 +184,7 @@ Replace(in, out) *out_cp++ = *in_text++; if (isQuotedString) { - nullP = index(out, '"'); + nullP = strchr(out, '"'); if (nullP == (char *)0) nullP = out_cp; } diff --git a/src/uss/uss_fs.c b/src/uss/uss_fs.c index 43fbaa0..d3d7af9 100644 --- a/src/uss/uss_fs.c +++ b/src/uss/uss_fs.c @@ -131,7 +131,7 @@ static char *ParentAndComponent(a_path, a_parentBuff, a_componentPP) * we cheat and return ``.''. */ strcpy(a_parentBuff, a_path); - rightSlashP = (char *) rindex(a_parentBuff, '/'); + rightSlashP = (char *) strrchr(a_parentBuff, '/'); if (rightSlashP) { *rightSlashP = 0; *a_componentPP = rightSlashP+1; diff --git a/src/uss/uss_kauth.c b/src/uss/uss_kauth.c index 1990f24..f95cbb9 100644 --- a/src/uss/uss_kauth.c +++ b/src/uss/uss_kauth.c @@ -30,7 +30,6 @@ RCSID("$Header$"); extern int errno; extern afs_int32 KAM_CreateUser(); -extern char *index(); #define uss_kauth_MAX_SIZE 2048 @@ -150,7 +149,7 @@ static char *getpipepass() { static char gpbuf[BUFSIZ]; /* read a password from stdin, stop on \n or eof */ register int i, tc; - bzero(gpbuf, sizeof(gpbuf)); + memset(gpbuf, 0, sizeof(gpbuf)); for(i=0; i<(sizeof(gpbuf)-1); i++) { tc = fgetc(stdin); if (tc == '\n' || tc == EOF) break; @@ -555,7 +554,7 @@ afs_int32 uss_kauth_CheckUserName() uss_whoami, UserCell); return(-1); } - if (index(UserPrincipal, ':') != NULL) { + if (strchr(UserPrincipal, ':') != NULL) { fprintf(stderr, "%s: User name '%s' can't have a colon\n", uss_whoami, UserPrincipal); return(-1); diff --git a/src/uss/uss_procs.c b/src/uss/uss_procs.c index ea6b426..c6e003c 100644 --- a/src/uss/uss_procs.c +++ b/src/uss/uss_procs.c @@ -43,7 +43,6 @@ extern int errno; char temp[1000]; extern int line; -extern char *rindex(); static int Copy(); static int Echo(); @@ -234,7 +233,7 @@ afs_int32 uss_procs_CpFile(a_path, a_mode, a_owner, a_proto) } if (stbuf.st_mode & S_IFDIR) { - if ((cp = rindex(a_path, '/')) == NULL) { + if ((cp = strrchr(a_path, '/')) == NULL) { strcat(a_proto, "/"); strcat(a_proto, a_path); } @@ -812,7 +811,7 @@ FILE *uss_procs_FindAndOpen(a_fileToOpen) /* * If a full pathname was given, just take it as is. */ - if (index(a_fileToOpen, '/')) { + if (strchr(a_fileToOpen, '/')) { strcpy(tmp_str, a_fileToOpen); rv = fopen(a_fileToOpen, "r"); } diff --git a/src/uss/uss_ptserver.c b/src/uss/uss_ptserver.c index 55c6286..530b115 100644 --- a/src/uss/uss_ptserver.c +++ b/src/uss/uss_ptserver.c @@ -30,7 +30,6 @@ extern int errno; #undef USS_PTSERVER_DB extern int line; -extern char *rindex(); /* diff --git a/src/uss/uss_vol.c b/src/uss/uss_vol.c index 450492b..a43d5c0 100644 --- a/src/uss/uss_vol.c +++ b/src/uss/uss_vol.c @@ -405,7 +405,7 @@ afs_int32 uss_vol_GetServer(a_name) th = gethostbyname(a_name); if (!th) return(0); - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); return(addr); } /*uss_vol_GetServer*/ diff --git a/src/util/hostparse.c b/src/util/hostparse.c index ef77c5f..bbe17df 100644 --- a/src/util/hostparse.c +++ b/src/util/hostparse.c @@ -77,7 +77,7 @@ register char *ahost; { /* decimal address, return fake hostent with only hostaddr field good */ tval = 0; dots = 0; - bzero(addr, sizeof(addr)); + memset(addr, 0, sizeof(addr)); while ((tc = *ahost++)) { if (tc == '.') { if (dots >= 3) return (struct hostent *) 0; /* too many dots */ diff --git a/src/util/kreltime.c b/src/util/kreltime.c index 85e7c7d..2e95321 100644 --- a/src/util/kreltime.c +++ b/src/util/kreltime.c @@ -76,7 +76,7 @@ Int32To_ktimeRelDate(int32Date, kdptr) afs_int32 int32Date; struct ktime_date *kdptr; { - bzero(kdptr, sizeof(*kdptr)); + memset(kdptr, 0, sizeof(*kdptr)); kdptr->day = int32Date % (MAX_DAY_VALUE + 1); if ( kdptr->day != 0 ) @@ -152,7 +152,7 @@ ParseRelDate(dateStr, relDatePtr) afs_int32 value, digit_limit; afs_int32 type_index; - bzero(relDatePtr, sizeof(*relDatePtr)); + memset(relDatePtr, 0, sizeof(*relDatePtr)); type_index = 0; while ( 1 ) diff --git a/src/util/ktime.c b/src/util/ktime.c index 20179a2..b2b2207 100644 --- a/src/util/ktime.c +++ b/src/util/ktime.c @@ -169,7 +169,7 @@ register char *astr; { struct ktime tk; -bzero(&tk, sizeof(tk)); +memset(&tk, 0, sizeof(tk)); if ( ParseTime(&tk, astr) ) return (-1); /* syntax error */ @@ -243,7 +243,7 @@ char *adate; { register afs_int32 code; struct ptemp *tp; - bzero(ak, sizeof(*ak)); + memset(ak, 0, sizeof(*ak)); code = LocalParseLine(adate, &tt); if (code) return -1; for(;tt;tt=tt->next) { diff --git a/src/util/uuid.c b/src/util/uuid.c index fe10766..79b99f2 100644 --- a/src/util/uuid.c +++ b/src/util/uuid.c @@ -19,8 +19,8 @@ RCSID("$Header$"); #ifdef KERNEL #include "../afs/sysincludes.h" #include "../afs/afsincludes.h" -#define uuid_memcmp(A,B,C) bcmp(A,B,C) -#define uuid_memcpy(A,B,C) bcopy(B,A,C) +#define uuid_memcmp(A,B,C) memcmp(A, B, C) +#define uuid_memcpy(A,B,C) memcpy(A, B, C) #else /* KERNEL */ #include #include diff --git a/src/util/volparse.c b/src/util/volparse.c index 09edb2a..727c2ec 100644 --- a/src/util/volparse.c +++ b/src/util/volparse.c @@ -85,7 +85,7 @@ char *volutil_PartitionName_r(int avalue, char *tbuffer, int buflen) tbuffer[0] = '\0'; return tbuffer; } - bzero(tbuffer, buflen); + memset(tbuffer, 0, buflen); tempString[1] = tempString[2] = 0; strcpy(tbuffer, "/vicep"); if (avalue < 0 || avalue >= (26*26+26)) { diff --git a/src/venus/cacheout.c b/src/venus/cacheout.c index 57d0aac..5928121 100644 --- a/src/venus/cacheout.c +++ b/src/venus/cacheout.c @@ -174,8 +174,8 @@ afs_int32 ListServers() afs_uint32 *p; /* get list of file servers in NW byte order */ - bzero(&addrs, sizeof(addrs)); - bzero(&spare3, sizeof(spare3)); + memset(&addrs, 0, sizeof(addrs)); + memset(&spare3, 0, sizeof(spare3)); code=ubik_Call(VL_GetAddrs,client,0,Handle,spare2,&spare3, &server_count,&addrs); if(code) diff --git a/src/venus/cmdebug.c b/src/venus/cmdebug.c index 128b070..182f5a4 100644 --- a/src/venus/cmdebug.c +++ b/src/venus/cmdebug.c @@ -165,7 +165,7 @@ struct cmd_syndesc *as; { printf("cmdebug: can't resolve address for host %s.\n", hostName); exit(1); } - bcopy(thp->h_addr, &addr, sizeof(afs_int32)); + memcpy(&addr, thp->h_addr, sizeof(afs_int32)); secobj = rxnull_NewServerSecurityObject(); conn = rx_NewConnection(addr, htons(port), 1, secobj, 0); if (!conn) { diff --git a/src/venus/fs.c b/src/venus/fs.c index dd50ac0..ea197b0 100644 --- a/src/venus/fs.c +++ b/src/venus/fs.c @@ -250,7 +250,7 @@ static char *Parent(apath) { char *tp; strcpy(tspace, apath); - tp = rindex(tspace, '/'); + tp = strrchr(tspace, '/'); if (tp) { *tp = 0; } @@ -1099,7 +1099,7 @@ static SetQuotaCmd(as) struct cmd_syndesc ts; /* copy useful stuff from our command slot; we may later have to reorder */ - bcopy(as, &ts, sizeof(ts)); /* copy whole thing */ + memcpy(&ts, as, sizeof(ts)); /* copy whole thing */ return SetVolCmd(&ts); } @@ -1234,7 +1234,7 @@ static WhereIsCmd(as) blob.out_size = MAXSIZE; blob.in_size = 0; blob.out = space; - bzero(space, sizeof(space)); + memset(space, 0, sizeof(space)); code = pioctl(ti->data, VIOCWHEREIS, &blob, 1); if (code) { Die(errno, ti->data); @@ -1373,7 +1373,7 @@ static ListMountCmd(as) * name (we know there is one) and splice in the symlink value. */ if (true_name[0] != '/') { - last_component = (char *) rindex(orig_name, '/'); + last_component = (char *) strrchr(orig_name, '/'); strcpy(++last_component, true_name); strcpy(true_name, orig_name); } @@ -1384,7 +1384,7 @@ static ListMountCmd(as) /* * Find rightmost slash, if any. */ - last_component = (char *) rindex(true_name, '/'); + last_component = (char *) strrchr(true_name, '/'); if (last_component) { /* * Found it. Designate everything before it as the parent directory, @@ -1414,7 +1414,7 @@ static ListMountCmd(as) blob.in_size = strlen(last_component)+1; blob.out_size = MAXSIZE; blob.out = space; - bzero(space, MAXSIZE); + memset(space, 0, MAXSIZE); code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, &blob, 1); @@ -1470,7 +1470,7 @@ defect #3069 /* Check for a cellname in the volume specification, and complain * if it doesn't match what was specified with -cell */ - if (tmpName = index(volName, ':')) { + if (tmpName = strchr(volName, ':')) { *tmpName = '\0'; if (cellName) { if (strcasecmp(cellName,volName)) { @@ -1550,7 +1550,7 @@ static RemoveMountCmd(as) for(ti=as->parms[0].items; ti; ti=ti->next) { /* once per file */ - tp = (char *) rindex(ti->data, '/'); + tp = (char *) strrchr(ti->data, '/'); if (tp) { strncpy(tbuffer, ti->data, code=tp-ti->data); /* the dir name */ tbuffer[code] = 0; @@ -1603,13 +1603,13 @@ static CheckServersCmd(as) struct afsconf_cell info; struct chservinfo checkserv; - bzero(&checkserv,sizeof(struct chservinfo)); + memset(&checkserv, 0, sizeof(struct chservinfo)); blob.in_size=sizeof(struct chservinfo); blob.in=(caddr_t)&checkserv; blob.out_size = MAXSIZE; blob.out = space; - bzero(space, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */ + memset(space, 0, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */ /* prepare flags for checkservers command */ temp = 2; /* default to checking local cell only */ @@ -1659,7 +1659,7 @@ static CheckServersCmd(as) Die(errno, 0); return 1; } - bcopy(space, &temp, sizeof(afs_int32)); + memcpy(&temp, space, sizeof(afs_int32)); if (checkserv.tinterval >= 0) { if (checkserv.tinterval > 0) printf("The new down server probe interval (%d secs) is now in effect (old interval was %d secs)\n", @@ -1674,7 +1674,7 @@ static CheckServersCmd(as) else { printf("These servers unavailable due to network or server problems: "); for(j=0; ; j++) { - bcopy(space + j*sizeof(afs_int32), &temp, sizeof(afs_int32)); + memcpy(&temp, space + j*sizeof(afs_int32), sizeof(afs_int32)); if (temp == 0) break; tp = hostutil_GetNameByINet(temp); printf(" %s", tp); @@ -1695,12 +1695,12 @@ static MessagesCmd(as) struct gaginfo gagflags; struct cmd_item *show; - bzero (&gagflags, sizeof(struct gaginfo)); + memset(&gagflags, 0, sizeof(struct gaginfo)); blob.in_size = sizeof(struct gaginfo); blob.in = (caddr_t) &gagflags; blob.out_size = MAXSIZE; blob.out = space; - bzero(space, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */ + memset(space, 0, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */ if (show = as->parms[0].items) { if (!strcasecmp (show->data, "user")) @@ -1826,7 +1826,7 @@ static ListCellsCmd(as) for(i=0;;i++) { tp = space; - bcopy(&i, tp, sizeof(afs_int32)); + memcpy(tp, &i, sizeof(afs_int32)); blob.out_size = MAXSIZE; blob.in_size = sizeof(afs_int32); blob.in = space; @@ -1843,7 +1843,7 @@ static ListCellsCmd(as) afs_int32 addr; char *name, tbuffer[20]; - bcopy(tp + j*sizeof(afs_int32), &addr, sizeof(afs_int32)); + memcpy(&addr, tp + j*sizeof(afs_int32), sizeof(afs_int32)); if (addr == 0) break; if (resolve) { @@ -1899,7 +1899,7 @@ static NewCellCmd(as) scount = ((cellname[0] != '\0') ? MAXCELLHOSTS : MAXHOSTS); /* Now setup and do the NEWCELL pioctl call */ - bzero(space, (scount+1) * sizeof(afs_int32)); + memset(space, 0, (scount+1) * sizeof(afs_int32)); tp = space; lp = (afs_int32 *)tp; *lp++ = 0x12345678; @@ -1911,7 +1911,7 @@ static NewCellCmd(as) pn, ti->data); } else { - bcopy(thp->h_addr, tp, sizeof(afs_int32)); + memcpy(tp, thp->h_addr, sizeof(afs_int32)); tp += sizeof(afs_int32); } } @@ -2048,7 +2048,7 @@ static MonitorCmd(as) return 1; } } - else bcopy(thp->h_addr, &hostAddr, sizeof(afs_int32)); + else memcpy(&hostAddr, thp->h_addr, sizeof(afs_int32)); } } else { @@ -2108,7 +2108,7 @@ static SysNameCmd(as) input += strlen(ti->data); *(input++) = '\0'; } - bcopy(&setp, space, sizeof(afs_int32)); + memcpy(space, &setp, sizeof(afs_int32)); code = pioctl(0, VIOC_AFS_SYSNAME, &blob, 1); if (code) { Die(errno, 0); @@ -2119,7 +2119,7 @@ static SysNameCmd(as) return 0; } input = space; - bcopy(input, &setp, sizeof(afs_int32)); + memcpy(&setp, input, sizeof(afs_int32)); input += sizeof(afs_int32); if (!setp) { fprintf(stderr, "No sysname name value was found\n"); @@ -2398,7 +2398,7 @@ static VLDBInit(noAuthFlag, info) pn, info->numServers, VLDB_MAXSERVERS); exit(1); } - bzero(serverconns, sizeof(serverconns)); + memset(serverconns, 0, sizeof(serverconns)); for (i = 0;inumServers;i++) serverconns[i] = rx_NewConnection(info->hostAddr[i].sin_addr.s_addr, info->hostAddr[i].sin_port, USER_SERVICE_ID, @@ -2493,7 +2493,7 @@ static addServer(name, rank) } sp = (struct spref *) (gblob.in + gblob.in_size); - bcopy (thostent->h_addr_list[t], &(sp->server.s_addr), sizeof(afs_uint32)); + memcpy(&(sp->server.s_addr), thostent->h_addr_list[t], sizeof(afs_uint32)); sp->rank = (rank > MAXUSHORT ? MAXUSHORT : rank); gblob.in_size += sizeof(struct spref); ssp->num_servers++; @@ -2724,7 +2724,7 @@ static StoreBehindCmd(as) blob.in = (char *)&tsb; blob.out = (char *)&tsb2; blob.in_size = blob.out_size = sizeof(struct sbstruct); - bzero (&tsb2, sizeof(tsb2)); + memset(&tsb2, 0, sizeof(tsb2)); /* once per -file */ for (ti=as->parms[1].items; ti; ti=ti->next) { @@ -2822,7 +2822,7 @@ static afs_int32 GetCryptCmd(as) if (code) Die(errno, (char *) 0); else { tp = space; - bcopy(tp, &flag, sizeof(afs_int32)); + memcpy(&flag, tp, sizeof(afs_int32)); printf("Security level is currently "); if (flag == 1) printf("crypt (data security).\n"); @@ -3306,7 +3306,7 @@ FlushMountCmd(as) * name (we know there is one) and splice in the symlink value. */ if (true_name[0] != '/') { - last_component = (char *) rindex(orig_name, '/'); + last_component = (char *) strrchr(orig_name, '/'); strcpy(++last_component, true_name); strcpy(true_name, orig_name); } @@ -3317,7 +3317,7 @@ FlushMountCmd(as) /* * Find rightmost slash, if any. */ - last_component = (char *) rindex(true_name, '/'); + last_component = (char *) strrchr(true_name, '/'); if (last_component) { /* * Found it. Designate everything before it as the parent directory, @@ -3346,7 +3346,7 @@ FlushMountCmd(as) blob.in = last_component; blob.in_size = strlen(last_component)+1; blob.out_size = 0; - bzero(space, MAXSIZE); + memset(space, 0, MAXSIZE); code = pioctl(parent_dir, VIOC_AFS_FLUSHMOUNT, &blob, 1); diff --git a/src/venus/fstrace.c b/src/venus/fstrace.c index 2b9035f..83855d2 100644 --- a/src/venus/fstrace.c +++ b/src/venus/fstrace.c @@ -1646,7 +1646,7 @@ icl_DumpKernel(outFilep, setname) if (dummy > bufferSize) /* find biggest log */ bufferSize = dummy; lip = (struct logInfo *) malloc(sizeof(struct logInfo)); - bzero((char *)lip, sizeof(*lip)); + memset((char *)lip, 0, sizeof(*lip)); lip->nextp = allInfo; allInfo = lip; lip->name = (char *) malloc(strlen(tname)+1); @@ -1664,7 +1664,7 @@ icl_DumpKernel(outFilep, setname) if (dummy > bufferSize) /* find biggest log */ bufferSize = dummy; lip = (struct logInfo *) malloc(sizeof(struct logInfo)); - bzero((char *)lip, sizeof(*lip)); + memset((char *)lip, 0, sizeof(*lip)); lip->nextp = allInfo; allInfo = lip; lip->name = (char *) malloc(strlen(tname)+1); @@ -2184,7 +2184,7 @@ icl_CreateSetWithFlags(name, baseLogp, fatalLogp, flags, outSetpp) states |= ICL_SETF_PERSISTENT; setp = (struct afs_icl_set *) osi_Alloc(sizeof(struct afs_icl_set)); - bzero((caddr_t)setp, sizeof(*setp)); + memset((caddr_t)setp, 0, sizeof(*setp)); setp->refCount = 1; if (states & ICL_SETF_FREED) states &= ~ICL_SETF_ACTIVE; /* if freed, can't be active */ @@ -2620,7 +2620,7 @@ afs_icl_bulkSetinfo_t *GetBulkSetInfo() exit (1); } } - bzero((char *)setInfo, infoSize); + memset((char *)setInfo, 0, infoSize); return setInfo; } @@ -2640,7 +2640,7 @@ afs_icl_bulkLoginfo_t *GetBulkLogInfo() } } - bzero((char *)logInfo, infoSize); + memset((char *)logInfo, 0, infoSize); return logInfo; } diff --git a/src/venus/kdump.c b/src/venus/kdump.c index 7aa9254..8cce218 100644 --- a/src/venus/kdump.c +++ b/src/venus/kdump.c @@ -1259,7 +1259,7 @@ int pnt; int chainCount[NSERVERS]; if (pnt) { - bzero((char*)chainCount, sizeof(chainCount)); + memset((char*)chainCount, 0, sizeof(chainCount)); printf("\n\nPrinting 'afs_servers' structures...\n"); } findsym( "afs_servers", &symoff); @@ -1297,7 +1297,7 @@ int pnt; /* Verify against afs_totalServers. */ if (pnt) { - bzero((char*)chainCount, sizeof(chainCount)); + memset((char*)chainCount, 0, sizeof(chainCount)); if (findsym( "afs_totalServers", &symoff)) { kread(kmem, symoff, (char*)&afs_totalServers, sizeof(afs_int32)); if (afs_totalServers != nServers) { @@ -2016,7 +2016,7 @@ void kread(int kmem,off_t loc,void *buf,KDUMP_SIZE_T len) { int i; - bzero(buf,len); + memset(buf, 0, len); #ifdef AFS_OSF_ENV if (mem) { diff --git a/src/venus/up.c b/src/venus/up.c index 6114b7f..51d158c 100644 --- a/src/venus/up.c +++ b/src/venus/up.c @@ -49,8 +49,6 @@ RCSID("$Header$"); #define MAXACL 400 -extern char *index (); -extern char *rindex (); #if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV) extern sys_nerr; extern char *sys_errlist[]; @@ -191,7 +189,7 @@ Boolean MakeParent(file, owner) strcpy(parent, file); - p = rindex(parent, '/'); + p = strrchr(parent, '/'); if (!p) { strcpy(parent, "."); } @@ -684,7 +682,7 @@ int isMountPoint( name, blob ) /* * Find rightmost slash, if any. */ - last_component = (char *) rindex(true_name, '/'); + last_component = (char *) strrchr(true_name, '/'); if (last_component) { /* * Found it. Designate everything before it as the parent directory, @@ -713,7 +711,7 @@ int isMountPoint( name, blob ) blob->in_size = strlen(last_component)+1; blob->out_size = MAXSIZE; blob->out = space; - bzero(space, MAXSIZE); + memset(space, 0, MAXSIZE); code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, blob, 0); diff --git a/src/vfsck/dir.c b/src/vfsck/dir.c index 9138b30..48baea5 100644 --- a/src/vfsck/dir.c +++ b/src/vfsck/dir.c @@ -116,7 +116,7 @@ descend(parentino, inumber) register struct dinode *dp; struct inodesc curino; - bzero((char *)&curino, sizeof(struct inodesc)); + memset((char *)&curino, 0, sizeof(struct inodesc)); if (statemap[inumber] != DSTATE) errexit("BAD INODE %d TO DESCEND", statemap[inumber]); #if defined(ACLS) && defined(AFS_HPUX_ENV) @@ -202,11 +202,11 @@ dirscan(idesc) idesc->id_loc = 0; for (dp = fsck_readdir(idesc); dp != NULL; dp = fsck_readdir(idesc)) { dsize = dp->d_reclen; - bcopy((char *)dp, dbuf, dsize); + memcpy(dbuf, (char *)dp, dsize); idesc->id_dirp = (struct direct *)dbuf; if ((n = (*idesc->id_func)(idesc)) & ALTERED) { bp = getdirblk(idesc->id_blkno, blksiz); - bcopy(dbuf, (char *)dp, dsize); + memcpy((char *)dp, dbuf, dsize); dirty(bp); sbdirty(); } @@ -378,7 +378,7 @@ mkentry(idesc) dirp->d_ino = idesc->id_parent; /* ino to be entered is in id_parent */ dirp->d_reclen = newent.d_reclen; dirp->d_namlen = strlen(idesc->id_name); - bcopy(idesc->id_name, dirp->d_name, (int)dirp->d_namlen + 1); + memcpy(dirp->d_name, idesc->id_name, (int)dirp->d_namlen + 1); return (ALTERED|STOP); } @@ -387,7 +387,7 @@ chgino(idesc) { register struct direct *dirp = idesc->id_dirp; - if (bcmp(dirp->d_name, idesc->id_name, (int)dirp->d_namlen + 1)) + if (memcmp(dirp->d_name, idesc->id_name, (int)dirp->d_namlen + 1)) return (KEEPON); dirp->d_ino = idesc->id_parent; return (ALTERED|STOP); @@ -404,7 +404,7 @@ linkup(orphan, parentdir) char tempname[BUFSIZ]; extern int pass4check(); - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); dp = ginode(orphan); lostdir = (dp->di_mode & IFMT) == IFDIR; pwarn("UNREF %s ", lostdir ? "DIR" : "FILE"); @@ -482,7 +482,7 @@ linkup(orphan, parentdir) return (0); } len = strlen(lfname); - bcopy(lfname, pathp, len + 1); + memcpy(pathp, lfname, len + 1); pathp += len; len = lftempname(tempname, orphan); if (makeentry(lfdir, orphan, tempname) == 0) { @@ -492,7 +492,7 @@ linkup(orphan, parentdir) } lncntp[orphan]--; *pathp++ = '/'; - bcopy(tempname, pathp, len + 1); + memcpy(pathp, tempname, len + 1); pathp += len; if (lostdir) { dp = ginode(orphan); @@ -528,7 +528,7 @@ makeentry(parent, ino, name) if (parent < ROOTINO || parent >= maxino || ino < ROOTINO || ino >= maxino) return (0); - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = DATA; idesc.id_func = mkentry; idesc.id_number = parent; @@ -570,21 +570,21 @@ expanddir(dp) dblksize(&sblock, dp, lastbn + 1)); if (bp->b_errs) goto bad; - bcopy(bp->b_un.b_buf, firstblk, DIRBLKSIZ); + memcpy(firstblk, bp->b_un.b_buf, DIRBLKSIZ); bp = getdirblk(newblk, sblock.fs_bsize); if (bp->b_errs) goto bad; - bcopy(firstblk, bp->b_un.b_buf, DIRBLKSIZ); + memcpy(bp->b_un.b_buf, firstblk, DIRBLKSIZ); for (cp = &bp->b_un.b_buf[DIRBLKSIZ]; cp < &bp->b_un.b_buf[sblock.fs_bsize]; cp += DIRBLKSIZ) - bcopy((char *)&emptydir, cp, sizeof emptydir); + memcpy(cp, (char *)&emptydir, sizeof emptydir); dirty(bp); bp = getdirblk(dp->di_db[lastbn + 1], dblksize(&sblock, dp, lastbn + 1)); if (bp->b_errs) goto bad; - bcopy((char *)&emptydir, bp->b_un.b_buf, sizeof emptydir); + memcpy(bp->b_un.b_buf, (char *)&emptydir, sizeof emptydir); pwarn("NO SPACE LEFT IN %s", pathname); if (preen) printf(" (EXPANDED)\n"); @@ -623,11 +623,11 @@ allocdir(parent, request, mode) freeino(ino); return (0); } - bcopy((char *)&dirhead, bp->b_un.b_buf, sizeof dirhead); + memcpy(bp->b_un.b_buf, (char *)&dirhead, sizeof dirhead); for (cp = &bp->b_un.b_buf[DIRBLKSIZ]; cp < &bp->b_un.b_buf[sblock.fs_fsize]; cp += DIRBLKSIZ) - bcopy((char *)&emptydir, cp, sizeof emptydir); + memcpy(cp, (char *)&emptydir, sizeof emptydir); dirty(bp); dp->di_nlink = 2; inodirty(); @@ -645,8 +645,7 @@ allocdir(parent, request, mode) inp->i_isize = dp->di_size; inp->i_numblks = dp->di_blocks * sizeof(daddr_t); inp->i_parent = parent; - bcopy((char *)&dp->di_db[0], (char *)&inp->i_blks[0], - (int)inp->i_numblks); + memcpy((char *)&inp->i_blks[0], (char *)&dp->di_db[0], (int)inp->i_numblks); } #endif if (ino == ROOTINO) { diff --git a/src/vfsck/inode.c b/src/vfsck/inode.c index 174d161..453fecb 100644 --- a/src/vfsck/inode.c +++ b/src/vfsck/inode.c @@ -423,7 +423,7 @@ findname(idesc) if (dirp->d_ino != idesc->id_parent) return (KEEPON); - bcopy(dirp->d_name, idesc->id_name, (int)dirp->d_namlen + 1); + memcpy(idesc->id_name, dirp->d_name, (int)dirp->d_namlen + 1); return (STOP|FOUND); } @@ -607,7 +607,7 @@ freeino(ino) extern int pass4check(); struct dinode *dp; - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = ADDR; idesc.id_func = pass4check; idesc.id_number = ino; diff --git a/src/vfsck/main.c b/src/vfsck/main.c index 94127ce..45add56 100644 --- a/src/vfsck/main.c +++ b/src/vfsck/main.c @@ -1092,7 +1092,7 @@ n printf("(%d frags, %d blocks, %.1f%% fragmentation)\n", msgprintf("%s: AFS file system partition was modified; forcing full salvage\n", devname); devname = unrawname(devname); - special = (char *) rindex(devname, '/'); + special = (char *) strrchr(devname, '/'); if (!special++) special = devname; strcpy(pname, "/etc/vfsck."); /* Using /etc, rather than /tmp, since /tmp is a link to /usr/tmp on some systems, and isn't mounted now */ diff --git a/src/vfsck/pass1.c b/src/vfsck/pass1.c index 42daec3..88f4e32 100644 --- a/src/vfsck/pass1.c +++ b/src/vfsck/pass1.c @@ -96,7 +96,7 @@ pass1() /* * Find all allocated blocks. */ - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = ADDR; idesc.id_func = pass1check; inumber = 0; @@ -110,10 +110,9 @@ pass1() continue; dp = ginode(inumber); if ((dp->di_mode & IFMT) == 0) { - if (bcmp((char *)dp->di_db, (char *)zino.di_db, + if (memcmp((char *)dp->di_db, (char *)zino.di_db, NDADDR * sizeof(daddr_t)) || - bcmp((char *)dp->di_ib, (char *)zino.di_ib, - NIADDR * sizeof(daddr_t)) || + memcmp((char *)dp->di_ib, (char *)zino.di_ib, NIADDR * sizeof(daddr_t)) || #if defined(ACLS) && defined(AFS_HPUX_ENV) dp->di_mode || dp->di_size || dp->di_contin) { if (dp->di_contin != 0) diff --git a/src/vfsck/pass1b.c b/src/vfsck/pass1b.c index 3a0e43b..52dfc7a 100644 --- a/src/vfsck/pass1b.c +++ b/src/vfsck/pass1b.c @@ -74,7 +74,7 @@ pass1b() struct inodesc idesc; ino_t inumber; - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = ADDR; idesc.id_func = pass1bcheck; duphead = duplist; diff --git a/src/vfsck/pass2.c b/src/vfsck/pass2.c index b546223..1d47db1 100644 --- a/src/vfsck/pass2.c +++ b/src/vfsck/pass2.c @@ -83,7 +83,7 @@ pass2() register struct dinode *dp; struct inodesc rootdesc; - bzero((char *)&rootdesc, sizeof(struct inodesc)); + memset((char *)&rootdesc, 0, sizeof(struct inodesc)); rootdesc.id_type = ADDR; rootdesc.id_func = pass2check; rootdesc.id_number = ROOTINO; @@ -207,17 +207,17 @@ pass2check(idesc) #endif } else if (dirp->d_reclen < 2 * entrysize) { proto.d_reclen = dirp->d_reclen; - bcopy((char *)&proto, (char *)dirp, entrysize); + memcpy((char *)dirp, (char *)&proto, entrysize); if (reply("FIX") == 1) ret |= ALTERED; } else { n = dirp->d_reclen - entrysize; proto.d_reclen = entrysize; - bcopy((char *)&proto, (char *)dirp, entrysize); + memcpy((char *)dirp, (char *)&proto, entrysize); idesc->id_entryno++; lncntp[dirp->d_ino]--; dirp = (struct direct *)((char *)(dirp) + entrysize); - bzero((char *)dirp, n); + memset((char *)dirp, 0, n); dirp->d_reclen = n; if (reply("FIX") == 1) ret |= ALTERED; @@ -238,7 +238,7 @@ chk1: idesc->id_entryno++; lncntp[dirp->d_ino]--; dirp = (struct direct *)((char *)(dirp) + n); - bzero((char *)dirp, n); + memset((char *)dirp, 0, n); dirp->d_reclen = n; } if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") == 0) { @@ -264,7 +264,7 @@ chk1: #endif } else { proto.d_reclen = dirp->d_reclen; - bcopy((char *)&proto, (char *)dirp, entrysize); + memcpy((char *)dirp, (char *)&proto, entrysize); if (reply("FIX") == 1) ret |= ALTERED; } @@ -295,7 +295,7 @@ chk2: *pathp = '\0'; errexit("NAME TOO LONG %s%s\n", pathname, dirp->d_name); } - bcopy(dirp->d_name, pathp, (int)dirp->d_namlen + 1); + memcpy(pathp, dirp->d_name, (int)dirp->d_namlen + 1); pathp += dirp->d_namlen; idesc->id_entryno++; n = 0; diff --git a/src/vfsck/pass3.c b/src/vfsck/pass3.c index cf1abb8..bf0f363 100644 --- a/src/vfsck/pass3.c +++ b/src/vfsck/pass3.c @@ -75,7 +75,7 @@ pass3() ino_t inumber, orphan; int loopcnt; - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = DATA; for (inumber = ROOTINO; inumber <= lastino; inumber++) { #if defined(ACLS) && defined(AFS_HPUX_ENV) diff --git a/src/vfsck/pass4.c b/src/vfsck/pass4.c index 274e1ba..013cc47 100644 --- a/src/vfsck/pass4.c +++ b/src/vfsck/pass4.c @@ -78,7 +78,7 @@ pass4() #endif /* ACLS */ - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = ADDR; idesc.id_func = pass4check; for (inumber = ROOTINO; inumber <= lastino; inumber++) { diff --git a/src/vfsck/pass5.c b/src/vfsck/pass5.c index c011a22..d96a257 100644 --- a/src/vfsck/pass5.c +++ b/src/vfsck/pass5.c @@ -101,7 +101,7 @@ pass5() struct cg *ocg = (struct cg *) buf; #endif /* AFS_NEWCG_ENV */ - bzero((char *)newcg, (int)fs->fs_cgsize); + memset((char *)newcg, 0, (int)fs->fs_cgsize); newcg->cg_niblk = fs->fs_ipg; #ifdef AFS_NEWCG_ENV postype = (int) fs->fs_postblformat; @@ -157,10 +157,10 @@ pass5() #endif /* AFS_NEWCG_ENV */ } - bzero((char *)&idesc[0], sizeof idesc); + memset((char *)&idesc[0], 0, sizeof idesc); for (i = 0; i < 3; i++) idesc[i].id_type = ADDR; - bzero((char *)&cstotal, sizeof(struct csum)); + memset((char *)&cstotal, 0, sizeof(struct csum)); (void)time(&now); #ifdef notdef /* this is the original from UCB/McKusick, but it is clearly wrong. It is @@ -216,14 +216,14 @@ pass5() newcg->cg_irotor = cg->cg_irotor; else newcg->cg_irotor = 0; - bzero((char *)&newcg->cg_frsum[0], sizeof newcg->cg_frsum); + memset((char *)&newcg->cg_frsum[0], 0, sizeof newcg->cg_frsum); #ifdef AFS_NEWCG_ENV - bzero((char *)&cg_blktot(newcg)[0], sumsize + mapsize); + memset((char *)&cg_blktot(newcg)[0], 0, sumsize + mapsize); #else /* AFS_NEWCG_ENV */ - bzero((char *)newcg->cg_btot, sizeof(newcg->cg_btot)); - bzero((char *)newcg->cg_b, sizeof(newcg->cg_b)); - bzero((char *)newcg->cg_iused, sizeof(newcg->cg_iused)); - bzero((char *)newcg->cg_free, howmany(fs->fs_fpg, NBBY)); + memset((char *)newcg->cg_btot, 0, sizeof(newcg->cg_btot)); + memset((char *)newcg->cg_b, 0, sizeof(newcg->cg_b)); + memset((char *)newcg->cg_iused, 0, sizeof(newcg->cg_iused)); + memset((char *)newcg->cg_free, 0, howmany(fs->fs_fpg, NBBY)); #endif /* AFS_NEWCG_ENV */ #ifdef AFS_NEWCG_ENV if (fs->fs_postblformat == FS_42POSTBLFMT) @@ -319,49 +319,46 @@ pass5() cstotal.cs_nifree += newcg->cg_cs.cs_nifree; cstotal.cs_ndir += newcg->cg_cs.cs_ndir; cs = &fs->fs_cs(fs, c); - if (bcmp((char *)&newcg->cg_cs, (char *)cs, sizeof *cs) != 0 && + if (memcmp((char *)&newcg->cg_cs, (char *)cs, sizeof *cs) != 0 && dofix(&idesc[0], "FREE BLK COUNT(S) WRONG IN CYL GROUP (SUPERBLK)")) { - bcopy((char *)&newcg->cg_cs, (char *)cs, sizeof *cs); + memcpy((char *)cs, (char *)&newcg->cg_cs, sizeof *cs); sbdirty(); } #ifdef AFS_NEWCG_ENV if (cvtflag) { - bcopy((char *)newcg, (char *)cg, (int)fs->fs_cgsize); + memcpy((char *)cg, (char *)newcg, (int)fs->fs_cgsize); cgdirty(); continue; } #endif /* AFS_NEWCG_ENV */ #ifdef AFS_NEWCG_ENV - if (bcmp(cg_inosused(newcg), + if (memcmp(cg_inosused(newcg), cg_inosused(cg), mapsize) != 0 && dofix(&idesc[1], "BLK(S) MISSING IN BIT MAPS")) { - bcopy(cg_inosused(newcg), cg_inosused(cg), mapsize); + memcpy(cg_inosused(cg), cg_inosused(newcg), mapsize); cgdirty(); } #else /* AFS_NEWCG_ENV */ - if (bcmp(newcg->cg_iused, + if (memcmp(newcg->cg_iused, cg->cg_iused, mapsize) != 0 && dofix(&idesc[1], "BLK(S) MISSING IN BIT MAPS")) { - bcopy(newcg->cg_iused, cg->cg_iused, mapsize); + memcpy(cg->cg_iused, newcg->cg_iused, mapsize); cgdirty(); } #endif /* AFS_NEWCG_ENV */ - if ((bcmp((char *)newcg, (char *)cg, basesize) != 0 || + if ((memcmp((char *)newcg, (char *)cg, basesize) != 0 || #ifdef AFS_NEWCG_ENV - bcmp((char *)&cg_blktot(newcg)[0], - (char *)&cg_blktot(cg)[0], sumsize) != 0) && + memcmp((char *)&cg_blktot(newcg)[0], (char *)&cg_blktot(cg)[0], sumsize) != 0) && #else /* AFS_NEWCG_ENV */ - bcmp((char *)newcg->cg_btot, - (char *)cg->cg_btot, sumsize) != 0) && + memcmp((char *)newcg->cg_btot, (char *)cg->cg_btot, sumsize) != 0) && #endif /* AFS_NEWCG_ENV */ dofix(&idesc[2], "SUMMARY INFORMATION BAD")) { #ifdef AFS_NEWCG_ENV - bcopy((char *)newcg, (char *)cg, basesize); - bcopy((char *)&cg_blktot(newcg)[0], - (char *)&cg_blktot(cg)[0], sumsize); + memcpy((char *)cg, (char *)newcg, basesize); + memcpy((char *)&cg_blktot(cg)[0], (char *)&cg_blktot(newcg)[0], sumsize); #else /* AFS_NEWCG_ENV */ - bcopy((char *)newcg, (char *)cg, basesize); - bcopy((char *)newcg->cg_btot, (char *)cg->cg_btot, sumsize); + memcpy((char *)cg, (char *)newcg, basesize); + memcpy((char *)cg->cg_btot, (char *)newcg->cg_btot, sumsize); #endif /* AFS_NEWCG_ENV */ cgdirty(); } @@ -370,9 +367,9 @@ pass5() if (fs->fs_postblformat == FS_42POSTBLFMT) fs->fs_nrpos = savednrpos; #endif /* AFS_NEWCG_ENV */ - if (bcmp((char *)&cstotal, (char *)&fs->fs_cstotal, sizeof *cs) != 0 + if (memcmp((char *)&cstotal, (char *)&fs->fs_cstotal, sizeof *cs) != 0 && dofix(&idesc[0], "FREE BLK COUNT(S) WRONG IN SUPERBLK")) { - bcopy((char *)&cstotal, (char *)&fs->fs_cstotal, sizeof *cs); + memcpy((char *)&fs->fs_cstotal, (char *)&cstotal, sizeof *cs); fs->fs_ronly = 0; sbfine(fs); sbdirty(); diff --git a/src/vfsck/proplist.c b/src/vfsck/proplist.c index 5a33837..df39673 100644 --- a/src/vfsck/proplist.c +++ b/src/vfsck/proplist.c @@ -173,8 +173,7 @@ int proplist_blkscan(dp, idesc, entry_list) return(SKIP); entry->next = NULL; entry->flags = 0; - bcopy((char *)&pl_descp[1], entry->name, - pl_descp->pl_namelen); + memcpy(entry->name, (char *)&pl_descp[1], pl_descp->pl_namelen); entry->blkno = idesc->id_blkno; entry->blksize = blksize; entry->offset = idesc->id_loc; diff --git a/src/vfsck/setup.c b/src/vfsck/setup.c index f3797af..19937ba 100644 --- a/src/vfsck/setup.c +++ b/src/vfsck/setup.c @@ -109,7 +109,6 @@ struct bufarea *pbp; /* block map */ howmany((fs)->fs_cpg * (fs)->fs_spc / NSPF(fs), NBBY)) char *malloc(), *calloc(); -char *index(); struct disklabel *getdisklabel(); setup(dev) @@ -485,8 +484,7 @@ restat: } #endif /* AFS_NEWCG_ENV */ if (asblk.b_dirty) { - bcopy((char *)&sblock, (char *)&altsblock, - (int)sblock.fs_sbsize); + memcpy((char *)&altsblock, (char *)&sblock, (int)sblock.fs_sbsize); flush(fswritefd, &asblk); } /* @@ -695,23 +693,18 @@ readsb(listerr) #if !defined(__alpha) && !defined(AFS_SUN56_ENV) #if !defined(AFS_HPUX110_ENV) /* HPUX110 will use UpdateAlternateSuper() below */ - bcopy((char *)sblock.fs_csp, (char *)altsblock.fs_csp, - sizeof sblock.fs_csp); + memcpy((char *)altsblock.fs_csp, (char *)sblock.fs_csp, sizeof sblock.fs_csp); #endif /* ! AFS_HPUX110_ENV */ #endif /* ! __alpha */ #if defined(AFS_SUN56_ENV) - bcopy((char *)sblock.fs_u.fs_csp_pad, (char *)altsblock.fs_u.fs_csp_pad, - sizeof (sblock.fs_u.fs_csp_pad)); + memcpy((char *)altsblock.fs_u.fs_csp_pad, (char *)sblock.fs_u.fs_csp_pad, sizeof (sblock.fs_u.fs_csp_pad)); #endif - bcopy((char *)sblock.fs_fsmnt, (char *)altsblock.fs_fsmnt, - sizeof sblock.fs_fsmnt); + memcpy((char *)altsblock.fs_fsmnt, (char *)sblock.fs_fsmnt, sizeof sblock.fs_fsmnt); #ifndef AFS_HPUX_ENV - bcopy((char *)sblock.fs_sparecon, (char *)altsblock.fs_sparecon, - sizeof sblock.fs_sparecon); + memcpy((char *)altsblock.fs_sparecon, (char *)sblock.fs_sparecon, sizeof sblock.fs_sparecon); #endif #if defined(AFS_DEC_ENV) - bcopy((char *)sblock.fs_extra, (char *)altsblock.fs_extra, - sizeof sblock.fs_extra); + memcpy((char *)altsblock.fs_extra, (char *)sblock.fs_extra, sizeof sblock.fs_extra); altsblock.fs_deftimer = sblock.fs_deftimer; altsblock.fs_lastfsck = sblock.fs_lastfsck; altsblock.fs_gennum = sblock.fs_gennum; @@ -728,13 +721,12 @@ readsb(listerr) #if defined(AFS_HPUX110_ENV) UpdateAlternateSuper(&sblock, &altsblock); #endif /* AFS_HPUX110_ENV */ - if (bcmp((char *)&sblock, (char *)&altsblock, (int)sblock.fs_sbsize)) { + if (memcmp((char *)&sblock, (char *)&altsblock, (int)sblock.fs_sbsize)) { #ifdef __alpha - if (bcmp((char *)&sblock.fs_blank[0], + if (memcmp((char *)&sblock.fs_blank[0], (char *)&altsblock.fs_blank[0], MAXCSBUFS*sizeof(int))) { - bzero((char *)sblock.fs_blank, - sizeof(sblock.fs_blank)); + memset((char *)sblock.fs_blank, 0, sizeof(sblock.fs_blank)); } else { #endif /* __alpha */ badsb(listerr, diff --git a/src/vfsck/utilities.c b/src/vfsck/utilities.c index e5eb597..82750f6 100644 --- a/src/vfsck/utilities.c +++ b/src/vfsck/utilities.c @@ -419,7 +419,7 @@ bread(fd, buf, blk, size) #endif rwerror("SEEK", blk); errs = 0; - bzero(buf, (int)size); + memset(buf, 0, (int)size); printf("THE FOLLOWING DISK SECTORS COULD NOT BE READ:"); #ifdef AFS_SUN5_ENV for (cp = buf, i = 0; i < btodb(size); i++, cp += DEV_BSIZE) { @@ -578,7 +578,7 @@ getpathname(namebuf, curdir, ino) strcpy(namebuf, "?"); return; } - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = DATA; cp = &namebuf[BUFSIZ - 1]; *cp = '\0'; @@ -609,7 +609,7 @@ getpathname(namebuf, curdir, ino) cp -= len; if (cp < &namebuf[MAXNAMLEN]) break; - bcopy(namebuf, cp, len); + memcpy(cp, namebuf, len); *--cp = '/'; ino = idesc.id_number; } @@ -617,7 +617,7 @@ getpathname(namebuf, curdir, ino) strcpy(namebuf, "?"); return; } - bcopy(cp, namebuf, &namebuf[BUFSIZ] - cp); + memcpy(namebuf, cp, &namebuf[BUFSIZ] - cp); } void diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 5a1cef1..49b02c6 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -635,7 +635,7 @@ SRXAFS_FetchData (tcon, Fid, Pos, Len, OutStatus, CallBack, Sync) SetCallBackStruct(AddCallBack(client->host, Fid), CallBack); else { struct AFSFid myFid; - bzero(&myFid, sizeof(struct AFSFid)); + memset(&myFid, 0, sizeof(struct AFSFid)); myFid.Volume = Fid->Volume; SetCallBackStruct(AddVolCallBack(client->host, &myFid), CallBack); } @@ -836,7 +836,7 @@ SAFSS_FetchStatus (tcon, Fid, OutStatus, CallBack, Sync) SetCallBackStruct(AddCallBack(client->host, Fid), CallBack); else { struct AFSFid myFid; - bzero(&myFid, sizeof(struct AFSFid)); + memset(&myFid, 0, sizeof(struct AFSFid)); myFid.Volume = Fid->Volume; SetCallBackStruct(AddVolCallBack(client->host, &myFid), CallBack); } @@ -939,7 +939,7 @@ SRXAFS_BulkStatus(tcon, Fids, OutStats, CallBacks, Sync) &CallBacks->AFSCBs_val[i]); else { struct AFSFid myFid; - bzero(&myFid, sizeof(struct AFSFid)); + memset(&myFid, 0, sizeof(struct AFSFid)); myFid.Volume = tfid->Volume; SetCallBackStruct(AddVolCallBack(client->host, &myFid), &CallBacks->AFSCBs_val[i]); @@ -2802,7 +2802,7 @@ SAFSS_MakeDir (tcon, DirFid, Name, InStatus, OutFid, OutFidStatus, assert((SetAccessList(&targetptr, &volptr, &newACL, &newACLSize, &parentwhentargetnotdir, (AFSFid *)0, 0)) == 0); assert(parentwhentargetnotdir == 0); - bcopy((char *)VVnodeACL(parentptr), (char *)newACL, VAclSize(parentptr)); + memcpy((char *)newACL, (char *)VVnodeACL(parentptr), VAclSize(parentptr)); /* update the status for the target vnode */ Update_TargetVnodeStatus(targetptr, TVS_MKDIR, client, InStatus, @@ -3463,7 +3463,7 @@ static GetStatistics (tcon, Statistics) FS_LOCK AFSCallStats.GetStatistics++, AFSCallStats.TotalCalls++; FS_UNLOCK - bzero(Statistics, sizeof(*Statistics)); + memset(Statistics, 0, sizeof(*Statistics)); SetAFSStats(Statistics); SetVolumeStats(Statistics); SetSystemStats(Statistics); @@ -3842,7 +3842,7 @@ int SRXAFS_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVersio */ dataBytes = sizeof(struct afs_Stats); dataBuffP = (afs_int32 *)malloc(dataBytes); - bcopy(&afs_cmstats, dataBuffP, dataBytes); + memcpy(dataBuffP, &afs_cmstats, dataBytes); a_dataP->AFS_CollData_len = dataBytes>>2; a_dataP->AFS_CollData_val = dataBuffP; #else @@ -3869,7 +3869,7 @@ int SRXAFS_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVersio dataBytes = sizeof(struct afs_PerfStats); dataBuffP = (afs_int32 *)osi_Alloc(dataBytes); - bcopy(&afs_perfstats, dataBuffP, dataBytes); + memcpy(dataBuffP, &afs_perfstats, dataBytes); a_dataP->AFS_CollData_len = dataBytes>>2; a_dataP->AFS_CollData_val = dataBuffP; break; @@ -3896,7 +3896,7 @@ int SRXAFS_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVersio dataBytes = sizeof(struct fs_stats_FullPerfStats); dataBuffP = (afs_int32 *)osi_Alloc(dataBytes); - bcopy(&afs_FullPerfStats, dataBuffP, dataBytes); + memcpy(dataBuffP, &afs_FullPerfStats, dataBytes); a_dataP->AFS_CollData_len = dataBytes>>2; a_dataP->AFS_CollData_val = dataBuffP; #endif @@ -5457,7 +5457,7 @@ RXStore_AccessList(targetptr, AccessList) return(EINVAL); if ((newACL->size + 4) > VAclSize(targetptr)) return(E2BIG); - bcopy((char *) newACL,(char *) VVnodeACL(targetptr),(int)(newACL->size)); + memcpy((char *) VVnodeACL(targetptr), (char *) newACL, (int)(newACL->size)); acl_FreeACL(&newACL); return(0); @@ -5504,7 +5504,7 @@ Store_AccessList(targetptr, AccessList) return(EINVAL); if ((newACL->size + 4) > VAclSize(targetptr)) return(E2BIG); - bcopy((char *) newACL,(char *) VVnodeACL(targetptr),(int)(newACL->size)); + memcpy((char *) VVnodeACL(targetptr), (char *) newACL, (int)(newACL->size)); acl_FreeACL(&newACL); return(0); @@ -6718,7 +6718,7 @@ void SetVolumeStats(stats) for (part = DiskPartitionList; part && i < AFS_MSTATDISKS; part = part->next) { stats->Disks[i].TotalBlocks = part->totalUsable; stats->Disks[i].BlocksAvailable = part->free; - bzero(stats->Disks[i].Name, AFS_DISKNAMESIZE); + memset(stats->Disks[i].Name, 0, AFS_DISKNAMESIZE); strncpy(stats->Disks[i].Name, part->name, AFS_DISKNAMESIZE); i++; } diff --git a/src/viced/callback.c b/src/viced/callback.c index 772ec1c..0d943aa 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -1631,7 +1631,7 @@ main(argc, argv) register struct CallBack *cb; time_t now; - bzero(&fid, sizeof(fid)); + memset(&fid, 0, sizeof(fid)); argc--; argv++; while (argc && **argv == '-') { noptions++; diff --git a/src/viced/fsprobe.c b/src/viced/fsprobe.c index 0ee22e8..5e81439 100644 --- a/src/viced/fsprobe.c +++ b/src/viced/fsprobe.c @@ -98,7 +98,7 @@ main(argc, argv) printf("usage: pxclient \n"); exit(1); } - bzero((char *)&host, sizeof(struct sockaddr_in)); + memset((char *)&host, 0, sizeof(struct sockaddr_in)); host.sin_family = AF_INET; host.sin_addr.s_addr = inet_addr(av[0]); if (host.sin_addr.s_addr != -1) { @@ -108,7 +108,7 @@ main(argc, argv) hp = gethostbyname(av[0]); if (hp) { host.sin_family = hp->h_addrtype; - bcopy(hp->h_addr, (caddr_t)&host.sin_addr, hp->h_length); + memcpy((caddr_t)&host.sin_addr, hp->h_addr, hp->h_length); hostname = hp->h_name; } else { printf("unknown server host %s\n", av[0]); @@ -272,7 +272,7 @@ FetchData(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -332,7 +332,7 @@ FetchStatus(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -357,7 +357,7 @@ FetchACL(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -384,7 +384,7 @@ StoreData(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -394,7 +394,7 @@ StoreData(argp) ++argp; sscanf(&(*argp)[0], "%d", &filelength); ++argp; - bzero(&InStatus, sizeof(struct afsStoreStatus)); + memset(&InStatus, 0, sizeof(struct afsStoreStatus)); sscanf(&(*argp)[0], "%d", &mode); ++argp; sscanf(&(*argp)[0], "%d", &owner); @@ -462,11 +462,11 @@ StoreStatus(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; - bzero(&InStatus, sizeof(struct afsStoreStatus)); + memset(&InStatus, 0, sizeof(struct afsStoreStatus)); sscanf(&(*argp)[0], "%d", &mode); ++argp; sscanf(&(*argp)[0], "%d", &owner); @@ -507,7 +507,7 @@ StoreACL(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -536,13 +536,13 @@ RemoveFile(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; name = &argp[0][0]; ++argp; - bzero(&nameFid, sizeof(struct afsFidName)); + memset(&nameFid, 0, sizeof(struct afsFidName)); strcpy(nameFid.name, name); code = ubik_Call(AFS_RemoveFile, cstruct, 0, &fid, &nameFid, &hyp0, 0, &OutDirStatus, &OutFidStatus, &outFid, &tsync); @@ -566,13 +566,13 @@ CreateFile(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; name = &argp[0][0]; ++argp; - bzero(&InStatus, sizeof(struct afsStoreStatus)); + memset(&InStatus, 0, sizeof(struct afsStoreStatus)); sscanf(&(*argp)[0], "%d", &mode); ++argp; sscanf(&(*argp)[0], "%d", &owner); @@ -613,25 +613,25 @@ Rename(argp) ++argp; sscanf(&(*argp)[0], "%d", &ounique); ++argp; - bzero(&OldDirFid, sizeof(struct afsFid)); + memset(&OldDirFid, 0, sizeof(struct afsFid)); OldDirFid.Volume.low = 10; /* XXX */ OldDirFid.Vnode = ovnode; OldDirFid.Unique = ounique; oname = &argp[0][0]; ++argp; - bzero(&OldName, sizeof(struct afsFidName)); + memset(&OldName, 0, sizeof(struct afsFidName)); strcpy(OldName.name, oname); sscanf(&(*argp)[0], "%d", &nvnode); ++argp; sscanf(&(*argp)[0], "%d", &nunique); ++argp; - bzero(&NewDirFid, sizeof(struct afsFid)); + memset(&NewDirFid, 0, sizeof(struct afsFid)); NewDirFid.Volume.low = 10; /* XXX */ NewDirFid.Vnode = nvnode; NewDirFid.Unique = nunique; nname = &argp[0][0]; ++argp; - bzero(&NewName, sizeof(struct afsFidName)); + memset(&NewName, 0, sizeof(struct afsFidName)); strcpy(NewName.name, nname); code = ubik_Call(AFS_Rename, cstruct, 0, &OldDirFid, &OldName, &NewDirFid, &NewName, &hyp0, 0, &OutOldDirStatus, &OutNewDirStatus, @@ -657,7 +657,7 @@ Symlink(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -665,7 +665,7 @@ Symlink(argp) ++argp; linkcontents = &argp[0][0]; ++argp; - bzero(&InStatus, sizeof(struct afsStoreStatus)); + memset(&InStatus, 0, sizeof(struct afsStoreStatus)); sscanf(&(*argp)[0], "%d", &mode); ++argp; sscanf(&(*argp)[0], "%d", &owner); @@ -704,7 +704,7 @@ HardLink(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -714,7 +714,7 @@ HardLink(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&existingFid, sizeof(struct afsFid)); + memset(&existingFid, 0, sizeof(struct afsFid)); existingFid.Volume.low = 10; /* XXX */ existingFid.Vnode = vnode; existingFid.Unique = unique; @@ -740,13 +740,13 @@ MakeDir(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; name = &argp[0][0]; ++argp; - bzero(&InStatus, sizeof(struct afsStoreStatus)); + memset(&InStatus, 0, sizeof(struct afsStoreStatus)); sscanf(&(*argp)[0], "%d", &mode); ++argp; sscanf(&(*argp)[0], "%d", &owner); @@ -786,13 +786,13 @@ RemoveDir(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; name = &argp[0][0]; ++argp; - bzero(&nameFid, sizeof(struct afsFidName)); + memset(&nameFid, 0, sizeof(struct afsFidName)); strcpy(nameFid.name, name); code = ubik_Call(AFS_RemoveDir, cstruct, 0, &fid, &nameFid, &hyp0, 0, &OutDirStatus, &outFid, &tsync); @@ -820,7 +820,7 @@ Readdir(argp) ++argp; sscanf(&(*argp)[0], "%d", &length); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -882,7 +882,7 @@ Lookup(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -908,13 +908,13 @@ GetToken(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; sscanf(&(*argp)[0], "%d", &tokenId); ++argp; - bzero(&MinToken, sizeof(struct afsToken)); + memset(&MinToken, 0, sizeof(struct afsToken)); MinToken.tokenID.low = tokenId; /* XXX */ code = ubik_Call(AFS_GetToken, cstruct, 0, &fid, &MinToken, &hyp0, 0, &RealToken, &OutStatus, &tsync); @@ -945,7 +945,7 @@ KeepAlive(argp) struct afsFidExp fx; int code; - bzero(&fx, sizeof(struct afsFidExp)); + memset(&fx, 0, sizeof(struct afsFidExp)); sscanf(&(*argp)[0], "%d", &fx.fid.Volume.low); ++argp; sscanf(&(*argp)[0], "%d", &fx.fid.Vnode); @@ -955,7 +955,7 @@ KeepAlive(argp) sscanf(&(*argp)[0], "%d", &numExec); ++argp; sscanf(&(*argp)[0], "%d", &fx.keepAliveTime); - bzero(&fex, sizeof(struct afsBulkFEX)); + memset(&fex, 0, sizeof(struct afsBulkFEX)); fex.afsBulkFEX_val = &fx; fex.afsBulkFEX_len = 1; code = ubik_Call(AFS_BulkKeepAlive, cstruct, 0, &fex, numExec, 0, 0, 0, &spare4); diff --git a/src/viced/host.c b/src/viced/host.c index d5d3f78..0cda0be 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -143,7 +143,7 @@ static struct client *GetCE() entry = CEFree; CEFree = entry->next; CEs++; - bzero((char *)entry, CLIENT_TO_ZERO(entry)); + memset((char *)entry, 0, CLIENT_TO_ZERO(entry)); return(entry); } /*GetCE*/ @@ -225,7 +225,7 @@ static struct host *GetHT() entry = HTFree; HTFree = entry->next; HTs++; - bzero((char *)entry, HOST_TO_ZERO(entry)); + memset((char *)entry, 0, HOST_TO_ZERO(entry)); return(entry); } /*GetHT*/ @@ -1981,7 +1981,7 @@ h_CheckHosts() { afs_uint32 now = FT_ApproxTime(); - bzero((char *)&zerofid, sizeof(zerofid)); + memset((char *)&zerofid, 0, sizeof(zerofid)); /* * Send a probe to the workstation if it hasn't been heard from in * 15 minutes diff --git a/src/viced/physio.c b/src/viced/physio.c index 03e4fb8..c606ee5 100644 --- a/src/viced/physio.c +++ b/src/viced/physio.c @@ -154,14 +154,14 @@ DirHandle * file; { IH_RELEASE(file->dirh_handle); - bzero((char *)file, sizeof(DirHandle)); + memset((char *)file, 0, sizeof(DirHandle)); } FidZero (file) DirHandle * file; { - bzero((char *)file, sizeof(DirHandle)); + memset((char *)file, 0, sizeof(DirHandle)); } FidEq (afile, bfile) diff --git a/src/viced/profile.c b/src/viced/profile.c index 2d1113a..cc95a78 100644 --- a/src/viced/profile.c +++ b/src/viced/profile.c @@ -58,7 +58,7 @@ void StartProfiling() #if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV) /* Soon should handle aix profiling */ AllocProfBuf(); - bzero (profBuf, profBufSize); + memset(profBuf, 0, profBufSize); /* the following code is to replace the monitor call below */ /* monitor (PROFSTART, &etext, profBuf, profBufSize, 0); */ profileHeader.startpc = PROFSTART; diff --git a/src/viced/viced.c b/src/viced/viced.c index 1192020..4d7fef1 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -256,7 +256,7 @@ static int get_key(arock, akvno, akey) code = afsconf_GetKey(confDir, akvno, tkey.key); if (code) return code; - bcopy(tkey.key, akey, sizeof(tkey.key)); + memcpy(akey, tkey.key, sizeof(tkey.key)); return 0; } /*get_key*/ @@ -604,7 +604,7 @@ main(argc, argv) } else { char hoststr[16]; - bcopy(he->h_addr, &FS_HostAddr_NBO, 4); + memcpy(&FS_HostAddr_NBO, he->h_addr, 4); afs_inet_ntoa_r(FS_HostAddr_NBO, hoststr); FS_HostAddr_HBO = ntohl(FS_HostAddr_NBO); ViceLog(0,("FileServer %s has address %s (0x%x or 0x%x in host byte order)\n", @@ -742,9 +742,9 @@ static void ClearXStatValues() /* * Zero all xstat-related structures. */ - bzero((char *)(&afs_perfstats), sizeof(struct afs_PerfStats)); + memset((char *)(&afs_perfstats), 0, sizeof(struct afs_PerfStats)); #if FS_STATS_DETAILED - bzero((char *)(&afs_FullPerfStats), sizeof(struct fs_stats_FullPerfStats)); + memset((char *)(&afs_FullPerfStats), 0, sizeof(struct fs_stats_FullPerfStats)); /* * That's not enough. We have to set reasonable minima for diff --git a/src/vlserver/cnvldb.c b/src/vlserver/cnvldb.c index d5af35d..782f3ed 100644 --- a/src/vlserver/cnvldb.c +++ b/src/vlserver/cnvldb.c @@ -48,7 +48,7 @@ static char *Parent(apath) char *apath; { register char *tp; strcpy(tspace, apath); - tp = rindex(tspace, '/'); + tp = strrchr(tspace, '/'); if (tp) { *tp = 0; } @@ -584,7 +584,7 @@ convert_header(ofd, fd, fromv, tov, fromaddr, toaddr) if (fromv == 1) { if (tov == 1) { - bcopy (fromaddr, toaddr, sizeof(struct vlheader_1)); + memcpy(toaddr, fromaddr, sizeof(struct vlheader_1)); tvp1 = (struct vlheader_1 *) toaddr; w = write (fd, tvp1, sizeof(struct vlheader_1)); @@ -600,7 +600,7 @@ convert_header(ofd, fd, fromv, tov, fromaddr, toaddr) } else if (tov == 2 || tov == 3) { tvp1 = (struct vlheader_1 *) fromaddr; tvp2 = (struct vlheader_2 *) toaddr; - bzero(tvp2, sizeof(struct vlheader_2)); + memset(tvp2, 0, sizeof(struct vlheader_2)); tvp2->vital_header.vldbversion = htonl(tov); tvp2->vital_header.headersize = htonl(sizeof(struct vlheader_2)); diff = ntohl(tvp2->vital_header.headersize) - @@ -643,7 +643,7 @@ convert_header(ofd, fd, fromv, tov, fromaddr, toaddr) return EINVAL; } else if (fromv == 2 || fromv == 3 || fromv == 4) { if (tov == 2 || tov == 3 || tov == 4) { - bcopy (fromaddr, toaddr, sizeof(struct vlheader_2)); + memcpy(toaddr, fromaddr, sizeof(struct vlheader_2)); tvp2 = (struct vlheader_2 *) toaddr; tvp2->vital_header.vldbversion = htonl(tov); w = write (fd, tvp2, sizeof(struct vlheader_2)); @@ -655,7 +655,7 @@ convert_header(ofd, fd, fromv, tov, fromaddr, toaddr) } else if (tov == 1) { tvp2 = (struct vlheader_2 *) fromaddr; tvp1 = (struct vlheader_1 *) toaddr; - bzero(tvp1, sizeof(struct vlheader_1)); + memset(tvp1, 0, sizeof(struct vlheader_1)); tvp1->vital_header.vldbversion = htonl(1); tvp1->vital_header.headersize = htonl(sizeof(struct vlheader_1)); diff = ntohl(tvp1->vital_header.headersize) - ntohl(tvp2->vital_header.headersize); @@ -771,7 +771,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) vl.nextIdHash[1] = vlentryp->nextIdHash[1]; vl.nextIdHash[2] = vlentryp->nextIdHash[2]; vl.nextNameHash = vlentryp->nextNameHash; - bcopy(vlentryp->name, vl.name, 65); + memcpy(vl.name, vlentryp->name, 65); for (i = 0; i < 8; i++) { vl.serverNumber[i] = vlentryp->serverNumber[i]; vl.serverPartition[i] = vlentryp->serverPartition[i]; @@ -790,7 +790,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) struct vlentry_2 vl; struct vlentry_3 *xnvlentry = (struct vlentry_3 *) vlentryp; - bzero((char *)&vl, sizeof (struct vlentry_2)); + memset((char *)&vl, 0, sizeof (struct vlentry_2)); vl.volumeId[0] = xnvlentry->volumeId[0]; vl.volumeId[1] = xnvlentry->volumeId[1]; vl.volumeId[2] = xnvlentry->volumeId[2]; @@ -804,7 +804,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) } if (ntohl(xnvlentry->nextNameHash)) vl.nextNameHash = xnvlentry->nextNameHash; - bcopy(xnvlentry->name, vl.name, 65); + memcpy(vl.name, xnvlentry->name, 65); for (i = 0; i < 8; i++) { vl.serverNumber[i] = xnvlentry->serverNumber[i]; vl.serverPartition[i] = xnvlentry->serverPartition[i]; @@ -822,7 +822,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) diff = (tovers == 1 ? sizeof(struct vlheader_1) : sizeof(struct vlheader_2)) - (fromvers == 1 ? sizeof(struct vlheader_1) : sizeof(struct vlheader_2)); - bzero((char *)&vl, sizeof (struct vlentry_1)); + memset((char *)&vl, 0, sizeof (struct vlentry_1)); vl.volumeId[0] = xnvlentry->volumeId[0]; vl.volumeId[1] = xnvlentry->volumeId[1]; vl.volumeId[2] = xnvlentry->volumeId[2]; @@ -837,7 +837,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) if (ntohl(xnvlentry->nextNameHash)) vl.nextNameHash = htonl(ntohl(xnvlentry->nextNameHash) + diff); - bcopy(xnvlentry->name, vl.name, 65); + memcpy(vl.name, xnvlentry->name, 65); for (i = 0; i < 8; i++) { vl.serverNumber[i] = xnvlentry->serverNumber[i]; vl.serverPartition[i] = xnvlentry->serverPartition[i]; @@ -865,7 +865,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) * blocks go away and all vlentries after them move up in the vldb file. * When this happens, the linked list pointers need to be updated. */ - bcopy(vlentryp, &vl, sizeof(vl)); + memcpy(&vl, vlentryp, sizeof(vl)); for (i=0; i<3; i++) { vl.nextIdHash[i] = Conv4to3(vl.nextIdHash[i]); } diff --git a/src/vlserver/sascnvldb.c b/src/vlserver/sascnvldb.c index 77d7928..08a3667 100644 --- a/src/vlserver/sascnvldb.c +++ b/src/vlserver/sascnvldb.c @@ -95,7 +95,7 @@ static char *Parent(apath) char *apath; { register char *tp; strcpy(tspace, apath); - tp = rindex(tspace, '/'); + tp = strrchr(tspace, '/'); if (tp) { *tp = 0; } @@ -335,7 +335,7 @@ struct vlheader_2 *tvp1; struct vlheader_2 *tvp2; int i,j,diff; - bcopy (fromaddr, toaddr, sizeof(struct vlheader_2)); + memcpy(toaddr, fromaddr, sizeof(struct vlheader_2)); tvp2 = (struct vlheader_2 *) toaddr; tvp2->vital_header.vldbversion = htonl(2); diff --git a/src/vlserver/vlclient.c b/src/vlserver/vlclient.c index f6afd18..cdd049f 100644 --- a/src/vlserver/vlclient.c +++ b/src/vlserver/vlclient.c @@ -243,7 +243,7 @@ char *aname; { } th = gethostbyname(aname); if (!th) return 0; - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); return addr; } @@ -297,9 +297,9 @@ static handleit(as) while (1) { char line[500]; int nargs, releasetype; - bzero(&entry, sizeof(entry)); - bzero(&updateentry, sizeof(updateentry)); - bzero(&listbyattributes, sizeof(listbyattributes)); + memset(&entry, 0, sizeof(entry)); + memset(&updateentry, 0, sizeof(updateentry)); + memset(&listbyattributes, 0, sizeof(listbyattributes)); printf("vl> "); if (fgets(line, 499, stdin) == NULL) { printf("\n"); @@ -346,7 +346,7 @@ static handleit(as) } else if (!strcmp(oper,"ls")) { afs_int32 index, count, next_index; for (index = 0; 1; index = next_index) { - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry,cstruct,0,index,&count,&next_index,&entry); if (code) { printf("VL_ListEntry returned code = %d\n", code); @@ -366,7 +366,7 @@ static handleit(as) } printf("Enumerating all entries in vldb...\n"); for (index = 0; 1; index = next_index) { - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry,cstruct,0,index,&count,&next_index,&entry); if (code) { printf("VL_ListEntry returned code = %d\n", code); @@ -404,7 +404,7 @@ static handleit(as) } printf("Volumes not found in main hash tables in vldb...\n"); for (index = 0; 1; index = next_index) { - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry,cstruct,0,index,&count,&next_index,&entry); if (code) { printf("VL_ListEntry returned code = %d\n", code); @@ -456,10 +456,10 @@ static handleit(as) exit(1); } printf("Volumes not found in main hash tables in vldb will be fixed...\n"); - bzero(&updateentry, sizeof(updateentry)); + memset(&updateentry, 0, sizeof(updateentry)); for (index = 0; 1; index = next_index) { int n1=0, n2=0, n3=0, n4=0; - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry,cstruct,0,index,&count,&next_index,&entry); if (code) { printf("VL_ListEntry returned code = %d\n", code); @@ -531,7 +531,7 @@ static handleit(as) bulkentries entries; struct vldbentry *entry; - bzero(&entries,sizeof(entries)); + memset(&entries, 0, sizeof(entries)); fill_listattributes_entry(&listbyattributes, argp, nargs); display_listattributes_entry(&listbyattributes, 0); code = ubik_Call(VL_ListAttributes, cstruct, 0, &listbyattributes, &nentries, &entries); @@ -563,7 +563,7 @@ static handleit(as) for (si=0; si!=-1; si=nsi) { nentries = 0; - bzero(&entries,sizeof(entries)); + memset(&entries, 0, sizeof(entries)); code = ubik_Call(VL_ListAttributesN2, cstruct, 0, &listbyattributes, name, si, &nentries, &entries, &nsi); @@ -586,7 +586,7 @@ static handleit(as) fill_listattributes_entry(&listbyattributes, argp, nargs); display_listattributes_entry(&listbyattributes, 0); - bzero(&linkedvldbs, sizeof(vldb_list)); + memset(&linkedvldbs, 0, sizeof(vldb_list)); code = ubik_Call(VL_LinkedList, cstruct, 0, &listbyattributes, &netries, &linkedvldbs); if (code) { @@ -606,7 +606,7 @@ static handleit(as) fill_listattributes_entry(&listbyattributes, argp, nargs); display_listattributes_entry(&listbyattributes, 0); - bzero(&linkedvldbs, sizeof(vldb_list)); + memset(&linkedvldbs, 0, sizeof(vldb_list)); code = ubik_Call(VL_LinkedListN, cstruct, 0, &listbyattributes, &netries, &linkedvldbs); if (code) { @@ -632,7 +632,7 @@ static handleit(as) sscanf(&(*argp)[0], "%d", &voltype); code = ubik_Call(VL_GetEntryByID, cstruct, 0, id, voltype, &entry); display_entry(&entry, code); - bzero(&updateentry, sizeof(updateentry)); + memset(&updateentry, 0, sizeof(updateentry)); updateentry.Mask = VLUPDATE_VOLNAMEHASH; printf("\tRehashing namehash table for %s (%d)\n", entry.name, entry.volumeId[RWVOL]); code = ubik_Call(VL_UpdateEntry, cstruct, 0, entry.volumeId[RWVOL], -1, &updateentry, 0); @@ -643,7 +643,7 @@ static handleit(as) } else if (!strcmp(oper,"undelete")) { afs_int32 index, count, next_index; - bzero(&updateentry, sizeof(updateentry)); + memset(&updateentry, 0, sizeof(updateentry)); sscanf(&(*argp)[0], "%d", &id); ++argp, --nargs; sscanf(&(*argp)[0], "%d", &voltype); @@ -653,7 +653,7 @@ static handleit(as) } printf("Searching vldb for volume %d...\n", id); for (index = 0; 1; index = next_index) { - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry,cstruct,0,index,&count,&next_index,&entry); if (code) { printf("VL_ListEntry returned code = %d\n", code); @@ -873,10 +873,10 @@ static handleit(as) struct vldbentry *entry; afsUUID uuid; - bzero(&uuid,sizeof(uuid)); + memset(&uuid, 0, sizeof(uuid)); sscanf(&(*argp)[0], "%d", &i); ++argp, --nargs; - bcopy(&i, uuid.node, sizeof(i)); + memcpy(uuid.node, &i, sizeof(i)); if (nargs < 0 || nargs > 16) { printf("Illegal # entries = %d\n", nargs); @@ -907,7 +907,7 @@ static handleit(as) printf("cmdebug: can't resolve address for host %s"); continue; } - bcopy((afs_int32 *)h1->h_addr, &a1, sizeof(afs_uint32)); + memcpy(&a1, (afs_int32 *)h1->h_addr, sizeof(afs_uint32)); ++argp, --nargs; printf(" to %s\n", *argp); @@ -916,7 +916,7 @@ static handleit(as) printf("cmdebug: can't resolve address for host %s", *argp); continue; } - bcopy((afs_int32 *)h2->h_addr, &a2, sizeof(afs_uint32)); + memcpy(&a2, (afs_int32 *)h2->h_addr, sizeof(afs_uint32)); printf("changing 0x%x to 0x%x\n", ntohl(a1), ntohl(a2)); code = ubik_Call(VL_ChangeAddr, cstruct, 0, ntohl(a1), ntohl(a2)); diff --git a/src/vlserver/vldb_check.c b/src/vlserver/vldb_check.c index fb11255..4cb26d5 100644 --- a/src/vlserver/vldb_check.c +++ b/src/vlserver/vldb_check.c @@ -636,7 +636,7 @@ CheckIpAddrs(header) int ipindex, ipaddrs; afsUUID nulluuid; - bzero(&nulluuid, sizeof(nulluuid)); + memset(&nulluuid, 0, sizeof(nulluuid)); if (verbose) printf("Check Multihomed blocks\n"); @@ -828,8 +828,8 @@ WorkerBee(as, arock) maxentries = (header.vital_header.eofPtr / sizeof(vlentry)) + 1; record = (struct er *)malloc(maxentries * sizeof(struct er)); - bzero((char *)record, (maxentries * sizeof(struct er))); - bzero((char *)serveraddrs, sizeof(serveraddrs)); + memset((char *)record, 0, (maxentries * sizeof(struct er))); + memset((char *)serveraddrs, 0, sizeof(serveraddrs)); /* Will fill in the record array of entries it found */ ReadAllEntries(&header); diff --git a/src/vlserver/vlprocs.c b/src/vlserver/vlprocs.c index 9ad0686..730cff5 100644 --- a/src/vlserver/vlprocs.c +++ b/src/vlserver/vlprocs.c @@ -192,7 +192,7 @@ VL_CreateEntry(rxcall, newentry) goto abort; } - bzero(&tentry, sizeof(struct nvlentry)); + memset(&tentry, 0, sizeof(struct nvlentry)); /* Convert to its internal representation; both in host byte order */ if (errorcode = vldbentry_to_vlentry(trans, newentry, &tentry)) { FreeBlock(trans, blockindex); @@ -265,7 +265,7 @@ VL_CreateEntryN(rxcall, newentry) goto abort; } - bzero(&tentry, sizeof(struct nvlentry)); + memset(&tentry, 0, sizeof(struct nvlentry)); /* Convert to its internal representation; both in host byte order */ if (errorcode = nvldbentry_to_vlentry(trans, newentry, &tentry)) { FreeBlock(trans, blockindex); @@ -1701,8 +1701,8 @@ vital_vlheader *vital_header; if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)) return errorcode; VLog(5, ("GetStats %\n", rxinfo(rxcall))); - bcopy((char *)&cheader.vital_header, (char *) vital_header, sizeof(vital_vlheader)); - bcopy((char *)&dynamic_statistics, (char *) stats, sizeof(vldstats)); + memcpy((char *) vital_header, (char *)&cheader.vital_header, sizeof(vital_vlheader)); + memcpy((char *) stats, (char *)&dynamic_statistics, sizeof(vldstats)); return(ubik_EndTrans(trans)); } @@ -1724,7 +1724,7 @@ bulkaddrs *addrsp; COUNT_REQ(VLGETADDRS); addrsp->bulkaddrs_len = *nentries = 0; addrsp->bulkaddrs_val = 0; - bzero (spare3, sizeof (struct VLCallBack)); + memset(spare3, 0, sizeof (struct VLCallBack)); if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)) return errorcode; @@ -2579,7 +2579,7 @@ struct vldbentry *VldbEntry; { int i, j; - bzero(VldbEntry, sizeof(struct vldbentry)); + memset(VldbEntry, 0, sizeof(struct vldbentry)); strncpy(VldbEntry->name, VlEntry->name, sizeof(VldbEntry->name)); for (i=0; i < OMAXNSERVERS; i++) { if (VlEntry->serverNumber[i] == BADSERVERID) break; @@ -2617,7 +2617,7 @@ struct nvldbentry *VldbEntry; { int i, j; - bzero(VldbEntry, sizeof(struct vldbentry)); + memset(VldbEntry, 0, sizeof(struct vldbentry)); strncpy(VldbEntry->name, VlEntry->name, sizeof(VldbEntry->name)); for (i=0; i < NMAXNSERVERS; i++) { if (VlEntry->serverNumber[i] == BADSERVERID) break; @@ -2653,7 +2653,7 @@ struct uvldbentry *VldbEntry; { int i, j; - bzero(VldbEntry, sizeof(struct vldbentry)); + memset(VldbEntry, 0, sizeof(struct vldbentry)); strncpy(VldbEntry->name, VlEntry->name, sizeof(VldbEntry->name)); for (i=0; i < NMAXNSERVERS; i++) { if (VlEntry->serverNumber[i] == BADSERVERID) break; @@ -2889,7 +2889,7 @@ register afs_uint32 ipaddr1, ipaddr2; /* Change the registered uuuid addresses */ if (exp) { - bzero(&tuuid, sizeof(afsUUID)); + memset(&tuuid, 0, sizeof(afsUUID)); afs_htonuuid(&tuuid); exp->ex_hostuuid = tuuid; code = vlwrite(atrans, DOFFSET(ntohl(ex_addr[0]->ex_contaddrs[base]), diff --git a/src/vlserver/vlserver.c b/src/vlserver/vlserver.c index 569ebf5..74beacd 100644 --- a/src/vlserver/vlserver.c +++ b/src/vlserver/vlserver.c @@ -229,7 +229,7 @@ char **argv; printf("vlserver: couldn't get address of this host (%s).\n", hostname); exit(1); } - bcopy(th->h_addr,&myHost,sizeof(afs_int32)); + memcpy(&myHost, th->h_addr, sizeof(afs_int32)); #if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV) signal(SIGXCPU, CheckSignal_Signal); @@ -244,7 +244,7 @@ char **argv; vldb_confdir = tdir; /* Preserve our configuration dir */ /* rxvab no longer supported */ - bzero(&tkey, sizeof(tkey)); + memset(&tkey, 0, sizeof(tkey)); if (noAuth) afsconf_SetNoAuthFlag(tdir, 1); @@ -267,7 +267,7 @@ char **argv; } rx_SetRxDeadTime(50); - bzero(HostAddress, sizeof(HostAddress)); + memset(HostAddress, 0, sizeof(HostAddress)); initialize_dstats(); sc[0] = rxnull_NewServerSecurityObject(); diff --git a/src/vlserver/vlutils.c b/src/vlserver/vlutils.c index 7b4c490..2dda162 100644 --- a/src/vlserver/vlutils.c +++ b/src/vlserver/vlutils.c @@ -106,13 +106,13 @@ afs_int32 length; { for (i=0;inextIdHash[i]); nentry.nextNameHash = htonl(nep->nextNameHash); - bcopy(nep->name, nentry.name, VL_MAXNAMELEN); - bcopy(nep->serverNumber, nentry.serverNumber, NMAXNSERVERS); - bcopy(nep->serverPartition, nentry.serverPartition, NMAXNSERVERS); - bcopy(nep->serverFlags, nentry.serverFlags, NMAXNSERVERS); + memcpy(nentry.name, nep->name, VL_MAXNAMELEN); + memcpy(nentry.serverNumber, nep->serverNumber, NMAXNSERVERS); + memcpy(nentry.serverPartition, nep->serverPartition, NMAXNSERVERS); + memcpy(nentry.serverFlags, nep->serverFlags, NMAXNSERVERS); bufp = (char *)&nentry; } else { - bzero(&oentry, sizeof(struct vlentry)); + memset(&oentry, 0, sizeof(struct vlentry)); nep = (struct nvlentry *)buffer; for (i=0;ivolumeId[i]); @@ -123,10 +123,10 @@ afs_int32 length; { for (i=0;inextIdHash[i]); oentry.nextNameHash = htonl(nep->nextNameHash); - bcopy(nep->name, oentry.name, VL_MAXNAMELEN); - bcopy(nep->serverNumber, oentry.serverNumber, OMAXNSERVERS); - bcopy(nep->serverPartition, oentry.serverPartition, OMAXNSERVERS); - bcopy(nep->serverFlags, oentry.serverFlags, OMAXNSERVERS); + memcpy(oentry.name, nep->name, VL_MAXNAMELEN); + memcpy(oentry.serverNumber, nep->serverNumber, OMAXNSERVERS); + memcpy(oentry.serverPartition, nep->serverPartition, OMAXNSERVERS); + memcpy(oentry.serverFlags, nep->serverFlags, OMAXNSERVERS); bufp = (char *)&oentry; } return vlwrite(trans, offset, bufp, length); @@ -158,14 +158,14 @@ afs_int32 length; { for(i=0;inextIdHash[i] = ntohl(nep->nextIdHash[i]); nbufp->nextNameHash = ntohl(nep->nextNameHash); - bcopy(nep->name, nbufp->name, VL_MAXNAMELEN); - bcopy(nep->serverNumber, nbufp->serverNumber, NMAXNSERVERS); - bcopy(nep->serverPartition, nbufp->serverPartition, NMAXNSERVERS); - bcopy(nep->serverFlags, nbufp->serverFlags, NMAXNSERVERS); + memcpy(nbufp->name, nep->name, VL_MAXNAMELEN); + memcpy(nbufp->serverNumber, nep->serverNumber, NMAXNSERVERS); + memcpy(nbufp->serverPartition, nep->serverPartition, NMAXNSERVERS); + memcpy(nbufp->serverFlags, nep->serverFlags, NMAXNSERVERS); } else { oep = (struct vlentry *)bufp; nbufp = (struct nvlentry *)buffer; - bzero(nbufp, sizeof (struct nvlentry)); + memset(nbufp, 0, sizeof (struct nvlentry)); for(i=0;ivolumeId[i] = ntohl(oep->volumeId[i]); nbufp->flags = ntohl(oep->flags); @@ -175,10 +175,10 @@ afs_int32 length; { for(i=0;inextIdHash[i] = ntohl(oep->nextIdHash[i]); nbufp->nextNameHash = ntohl(oep->nextNameHash); - bcopy(oep->name, nbufp->name, VL_MAXNAMELEN); - bcopy(oep->serverNumber, nbufp->serverNumber, NMAXNSERVERS); - bcopy(oep->serverPartition, nbufp->serverPartition, NMAXNSERVERS); - bcopy(oep->serverFlags, nbufp->serverFlags, NMAXNSERVERS); + memcpy(nbufp->name, oep->name, VL_MAXNAMELEN); + memcpy(nbufp->serverNumber, oep->serverNumber, NMAXNSERVERS); + memcpy(nbufp->serverPartition, oep->serverPartition, NMAXNSERVERS); + memcpy(nbufp->serverFlags, oep->serverFlags, NMAXNSERVERS); } return 0; } @@ -303,7 +303,7 @@ afs_int32 CheckInit (trans, builddb) vldbversion = ntohl(cheader.vital_header.vldbversion); if (!ubcode && (vldbversion != 0)) { - bcopy(cheader.IpMappedAddr, HostAddress, sizeof(cheader.IpMappedAddr)); + memcpy(HostAddress, cheader.IpMappedAddr, sizeof(cheader.IpMappedAddr)); for (i=0; iex_flags = htonl(VLCONTBLOCK); @@ -515,7 +515,7 @@ struct nvlentry *tentry; } cheader.vital_header.allocs++; if (write_vital_vlheader(trans)) return 0; - bzero (tentry, sizeof(nvlentry)); /* zero new entry */ + memset(tentry, 0, sizeof(nvlentry)); /* zero new entry */ return blockindex; } @@ -528,7 +528,7 @@ afs_int32 blockindex; /* check validity of blockindex just to be on the safe side */ if (!index_OK (trans, blockindex)) return VL_BADINDEX; - bzero (&tentry, sizeof(nvlentry)); + memset(&tentry, 0, sizeof(nvlentry)); tentry.nextIdHash[0] = cheader.vital_header.freePtr; /* already in network order */ tentry.flags = htonl(VLFREE); cheader.vital_header.freePtr = htonl(blockindex); diff --git a/src/vol/clone.c b/src/vol/clone.c index 6d4f4fb..3645353 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -107,7 +107,7 @@ struct clone_head *ah; { /* initialize a clone header */ int ci_InitHead(struct clone_head *ah) { - bzero(ah, sizeof(*ah)); + memset(ah, 0, sizeof(*ah)); return 0; } diff --git a/src/vol/devname.c b/src/vol/devname.c index 45bcaff..1652502 100644 --- a/src/vol/devname.c +++ b/src/vol/devname.c @@ -201,14 +201,14 @@ dev_t adev; { #endif if (wpath) { strcpy(pbuf, pbuffer); - ptr = (char *)rindex(pbuf, '/'); + ptr = (char *)strrchr(pbuf, '/'); if (ptr) { *ptr = '\0'; strcpy(wpath, pbuf); } else return (char *)0; } - ptr = (char *)rindex(pbuffer, '/'); + ptr = (char *)strrchr(pbuffer, '/'); if (ptr) { strcpy(pbuffer, ptr+1); return pbuffer; diff --git a/src/vol/fs_conv_411.c b/src/vol/fs_conv_411.c index 2f4f8fa..1cf2ce5 100644 --- a/src/vol/fs_conv_411.c +++ b/src/vol/fs_conv_411.c @@ -930,14 +930,13 @@ char *vol_DevName(adev) return (char *) 0; /* failed */ } -extern char *rindex(); char *unrawname(name) char *name; { char *dp; struct stat stb; - if ((dp = rindex(name, '/')) == 0) + if ((dp = strrchr(name, '/')) == 0) return (name); if (stat(name, &stb) < 0) return (name); @@ -956,7 +955,7 @@ rawname(name) static char rawbuf[32]; char *dp; - if ((dp = rindex(name, '/')) == 0) + if ((dp = strrchr(name, '/')) == 0) return (0); *dp = 0; (void)strcpy(rawbuf, name); diff --git a/src/vol/fssync.c b/src/vol/fssync.c index 003ce48..a17d60f 100644 --- a/src/vol/fssync.c +++ b/src/vol/fssync.c @@ -234,7 +234,7 @@ static int getport(addr) { int sd; - bzero(addr, sizeof(*addr)); + memset(addr, 0, sizeof(*addr)); assert((sd = socket(AF_INET, SOCK_STREAM, 0)) >= 0); addr->sin_addr.s_addr = htonl(0x7f000001); addr->sin_family = AF_INET; /* was localhost->h_addrtype */ diff --git a/src/vol/nuke.c b/src/vol/nuke.c index c16dd5d..fd390b5 100644 --- a/src/vol/nuke.c +++ b/src/vol/nuke.c @@ -77,7 +77,7 @@ afs_int32 avolid; { /* record the info */ if (!allInodes || allInodes->freePtr >= MAXATONCE) { ti = (struct ilist *) malloc(sizeof(struct ilist)); - bzero(ti, sizeof(*ti)); + memset(ti, 0, sizeof(*ti)); ti->next = allInodes; allInodes = ti; } diff --git a/src/vol/physio.c b/src/vol/physio.c index eddcc22..a17b449 100644 --- a/src/vol/physio.c +++ b/src/vol/physio.c @@ -120,7 +120,7 @@ Inode inode; Device device; { static SalvageCacheCheck = 1; - bzero(dir, sizeof(DirHandle)); + memset(dir, 0, sizeof(DirHandle)); dir->dirh_device = device; dir->dirh_volume = volume; @@ -135,14 +135,14 @@ DirHandle * file; { IH_RELEASE(file->dirh_handle); - bzero(file, sizeof(DirHandle)); + memset(file, 0, sizeof(DirHandle)); } FidZero (file) DirHandle * file; { - bzero(file, sizeof(DirHandle)); + memset(file, 0, sizeof(DirHandle)); } FidEq (afile, bfile) diff --git a/src/vol/purge.c b/src/vol/purge.c index 7276c4c..3300f14 100644 --- a/src/vol/purge.c +++ b/src/vol/purge.c @@ -129,7 +129,7 @@ Volume *avp; { /* next, obliterate the index and fflush (and fsync) it */ STREAM_SEEK(afile, *aoffset, 0); /* seek back to start of vnode index region */ - bzero(buf, sizeof(buf)); /* zero out our proto-vnode */ + memset(buf, 0, sizeof(buf)); /* zero out our proto-vnode */ for(i=0;idiskSize, 1, afile) != 1) goto fail; diff --git a/src/vol/test/listVicepx.c b/src/vol/test/listVicepx.c index 3871b41..c3aeabc 100644 --- a/src/vol/test/listVicepx.c +++ b/src/vol/test/listVicepx.c @@ -124,7 +124,6 @@ char* orphan_NoUnique = "ORPHANED_NoUnique"; #define contentsDInode 0x08 /* list contents of dir inode */ #define volInfo 0x10 /* list info from vol header */ -extern char *rindex(); extern DirEnt *lookup(); extern char *getFileName(), *getDirName(), *printStack(); extern DirEnt* hash[]; diff --git a/src/vol/vnode.c b/src/vol/vnode.c index 63b83f1..4ab8859 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -382,7 +382,7 @@ Vnode *VAllocVnode_r(ec,vp,type) } else { /* growing file - grow in a reasonable increment */ char *buf = (char *)malloc(16*1024); - bzero(buf, 16*1024); + memset(buf, 0, 16*1024); FDH_WRITE(fdP, buf, 16*1024); free(buf); } @@ -398,7 +398,7 @@ Vnode *VAllocVnode_r(ec,vp,type) #else /* AFS_PTHREAD_ENV */ LWP_CurrentProcess(&vnp->writer); #endif /* AFS_PTHREAD_ENV */ - bzero(&vnp->disk, sizeof(vnp->disk)); + memset(&vnp->disk, 0, sizeof(vnp->disk)); vnp->changed_newTime = 0; /* set this bit when vnode is updated */ vnp->changed_oldTime = 0; /* set this on CopyOnWrite. */ vnp->delete = 0; @@ -698,7 +698,7 @@ VPutVnode_r(ec,vnp) if (vnp->delete) { /* No longer any directory entries for this vnode. Free the Vnode */ - bzero(&vnp->disk, sizeof (vnp->disk)); + memset(&vnp->disk, 0, sizeof (vnp->disk)); mlkLastDelete = vnp->vnodeNumber; /* delete flag turned off further down */ VNLog(202, 2, vnp->vnodeNumber, (afs_int32) vnp); diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index c97002e..c21c345 100644 --- a/src/vol/vol-info.c +++ b/src/vol/vol-info.c @@ -403,7 +403,7 @@ void HandlePart(struct DiskPartition *partP) if (dsizeOnly && !saveinodes) printf("Volume-Id\t Volsize Auxsize Inodesize AVolsize SizeDiff (VolName)\n"); while (dp = readdir(dirp)) { - p = (char *)rindex(dp->d_name, '.'); + p = (char *)strrchr(dp->d_name, '.'); if (p != NULL && strcmp(p, VHDREXT) == 0) { HandleVolume(partP, dp->d_name); Totvolsize += totvolsize; diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 3739928..608aa58 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -923,7 +923,7 @@ void SalvageFileSysParallel(struct DiskPartition *partP) Log("Can't salvage '%s'. Not enough memory\n", partP->name); return; } - bzero(thisjob, sizeof(struct job)); + memset(thisjob, 0, sizeof(struct job)); thisjob->partP = partP; thisjob->jobnumb = jobcount; jobcount++; @@ -2002,7 +2002,7 @@ int SalvageVolumeHeaderFile(register struct InodeSummary *isp, if (deleteMe) *deleteMe = 0; - bzero(&tempHeader, sizeof(tempHeader)); + memset(&tempHeader, 0, sizeof(tempHeader)); tempHeader.stamp.magic = VOLUMEHEADERMAGIC; tempHeader.stamp.version = VOLUMEHEADERVERSION; tempHeader.id = isp->volumeId; @@ -2083,7 +2083,7 @@ int SalvageVolumeHeaderFile(register struct InodeSummary *isp, isp->volSummary->header.volumeAcl = 0; isp->volSummary->header.volumeMountTable = 0; - if (bcmp(&isp->volSummary->header, &tempHeader, sizeof(struct VolumeHeader))) { + if (memcmp(&isp->volSummary->header, &tempHeader, sizeof(struct VolumeHeader))) { /* We often remove the name before calling us, so we make a fake one up */ if (isp->volSummary->fileName) { strcpy(name, isp->volSummary->fileName); @@ -2102,7 +2102,7 @@ int SalvageVolumeHeaderFile(register struct InodeSummary *isp, } } if (headerFd) { - bcopy(&tempHeader,&isp->volSummary->header,sizeof(struct VolumeHeader)); + memcpy(&isp->volSummary->header, &tempHeader, sizeof(struct VolumeHeader)); if (Testing) { if (!Showmode) Log("It would have written a new header file for volume %u\n", isp->volumeId); } else { @@ -2203,7 +2203,7 @@ int SalvageHeader(register struct stuff *sp, struct InodeSummary *isp, /* The following code should be moved into vutil.c */ if (sp->inodeType == VI_VOLINFO) { struct timeval tp; - bzero(&header.volumeInfo, sizeof (header.volumeInfo)); + memset(&header.volumeInfo, 0, sizeof (header.volumeInfo)); header.volumeInfo.stamp = sp->stamp; header.volumeInfo.id = isp->volumeId; header.volumeInfo.parentId = isp->RWvolumeId; @@ -2334,7 +2334,7 @@ int SalvageIndex(Inode ino, VnodeClass class, int RW, if (VNDISK_GET_INO(vnode) == 0) { if (RW) { /* Log("### DEBUG ### Deleted Vnode with 0 inode (vnode %d)\n", vnodeNumber); */ - bzero(vnode, vcp->diskSize); + memset(vnode, 0, vcp->diskSize); vnodeChanged = 1; } } @@ -2342,7 +2342,7 @@ int SalvageIndex(Inode ino, VnodeClass class, int RW, if (vcp->magic != vnode->vnodeMagic) { /* bad magic #, probably partially created vnode */ Log("Partially allocated vnode %d deleted.\n", vnodeNumber); - bzero(vnode, vcp->diskSize); + memset(vnode, 0, vcp->diskSize); vnodeChanged = 1; goto vnodeDone; } @@ -2512,7 +2512,7 @@ int SalvageIndex(Inode ino, VnodeClass class, int RW, } else { if (!Showmode) Log("Vnode %d (unique %d): bad directory vnode (no inode number listed); vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, ctime((time_t *)&(vnode->serverModifyTime))); } - bzero(vnode, vcp->diskSize); + memset(vnode, 0, vcp->diskSize); vnodeChanged = 1; } else { /* Should not reach here becuase we checked for @@ -2844,7 +2844,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber, assert(fdP != NULL); size = FDH_SIZE(fdP); assert(size != -1); - bzero(buf, 1024); + memset(buf, 0, 1024); if (size > 1024) size = 1024; code = FDH_READ(fdP, buf, size); assert(code == size); @@ -3087,7 +3087,7 @@ void SalvageDir(char *name, VolumeId rwVid, struct VnodeInfo *dirVnodeInfo, /* Remember rootdir DirSummary _after_ it has been judged */ if (dir.vnodeNumber == 1 && dir.unique == 1) { - bcopy(&dir, rootdir, sizeof(struct DirSummary)); + memcpy(rootdir, &dir, sizeof(struct DirSummary)); *rootdirfound = 1; } @@ -3299,7 +3299,7 @@ int SalvageVolume(register struct InodeSummary *rwIsp, IHandle_t *alinkH) code = IH_DEC(alinkH, VNDISK_GET_INO(&vnode), vid); assert(code == 0); } - bzero(&vnode, sizeof(vnode)); + memset(&vnode, 0, sizeof(vnode)); } } else if (vnp->count) { if (!Showmode) { diff --git a/src/vol/volume.c b/src/vol/volume.c index a451e17..e9b05ac 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -423,7 +423,7 @@ static void ReadHeader(Error *ec, IHandle_t *h, char *to, int size, void VolumeHeaderToDisk(VolumeDiskHeader_t *dh, VolumeHeader_t *h) { - bzero((char*)dh, sizeof(VolumeDiskHeader_t)); + memset((char*)dh, 0, sizeof(VolumeDiskHeader_t)); dh->stamp = h->stamp; dh->id = h->id; dh->parent = h->parent; @@ -453,7 +453,7 @@ void VolumeHeaderToDisk(VolumeDiskHeader_t *dh, VolumeHeader_t *h) */ void DiskToVolumeHeader(VolumeHeader_t *h, VolumeDiskHeader_t *dh) { - bzero((char*)h, sizeof(VolumeHeader_t)); + memset((char*)h, 0, sizeof(VolumeHeader_t)); h->stamp = dh->stamp; h->id = dh->id; h->parent = dh->parent; @@ -721,7 +721,7 @@ private Volume *attach2(ec, path, header, partp, isbusy) * area and mark it as initialized. */ if (! (V_stat_initialized(vp))) { - bzero((char *)(V_stat_area(vp)), VOL_STATS_BYTES); + memset((char *)(V_stat_area(vp)), 0, VOL_STATS_BYTES); V_stat_initialized(vp) = 1; } #endif /* TRANSARC_VOL_STATS */ @@ -1299,7 +1299,7 @@ int VAllocBitmapEntry_r(ec,vp,index) assert(bp != NULL); index->bitmap = bp; bp += index->bitmapSize; - bzero(bp, VOLUME_BITMAP_GROWSIZE); + memset(bp, 0, VOLUME_BITMAP_GROWSIZE); index->bitmapOffset = index->bitmapSize; index->bitmapSize += VOLUME_BITMAP_GROWSIZE; *bp = 1; @@ -1594,7 +1594,7 @@ VAdjustVolumeStatistics_r(vp) * All we need to do is bzero the entire VOL_STATS_BYTES of * the detailed volume statistics area. */ - bzero((char *)(V_stat_area(vp)), VOL_STATS_BYTES); + memset((char *)(V_stat_area(vp)), 0, VOL_STATS_BYTES); #endif /* TRANSARC_VOL_STATS */ } /*It's been more than a day of collection*/ diff --git a/src/vol/vutil.c b/src/vol/vutil.c index 7fadbcf..b2fafa1 100644 --- a/src/vol/vutil.c +++ b/src/vol/vutil.c @@ -124,7 +124,7 @@ Volume *VCreateVolume_r(ec, partname, volumeId, parentId) *ec = 0; - bzero(&vol, sizeof (vol)); + memset(&vol, 0, sizeof (vol)); vol.id = volumeId; vol.parentId = parentId; vol.copyDate = time(0); /* The only date which really means when this @@ -145,7 +145,7 @@ Volume *VCreateVolume_r(ec, partname, volumeId, parentId) nearInode %= partition->f_files; #endif VLockPartition(partname); - bzero(&tempHeader, sizeof (tempHeader)); + memset(&tempHeader, 0, sizeof (tempHeader)); tempHeader.stamp.magic = VOLUMEHEADERMAGIC; tempHeader.stamp.version = VOLUMEHEADERVERSION; tempHeader.id = vol.id; @@ -317,7 +317,7 @@ afs_int32 CopyVolumeHeader_r(from, to) id = to->id; parent = to->parentId; copydate = to->copyDate; - bcopy(from, to, sizeof(*from)); + memcpy(to, from, sizeof(*from)); to->id = id; to->parentId = parent; to->copyDate = copydate; @@ -349,7 +349,7 @@ ClearVolumeStats(vol) ClearVolumeStats_r(vol) register VolumeDiskData *vol; { - bzero(vol->weekUse, sizeof(vol->weekUse)); + memset(vol->weekUse, 0, sizeof(vol->weekUse)); vol->dayUse = 0; vol->dayUseDate = 0; } diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index 71ebfa3..9714b7d 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -205,7 +205,7 @@ static int ReadVolumeHeader(register struct iod *iodp, VolumeDiskData *vol) { register tag; afs_uint32 trash; - bzero(vol, sizeof(*vol)); + memset(vol, 0, sizeof(*vol)); while ((tag = iod_getc(iodp)) > D_MAX && tag != EOF) { switch (tag) { case 'i': @@ -488,7 +488,7 @@ static int DumpFile(struct iod *iodp, char tag, int vnode, FdHandle_t *handleP) /* Pad the rest of the buffer with zeros. Remember offset we started * padding. Keep total tally of padding. */ - bzero(p+n, howMany-n); + memset(p+n, 0, howMany-n); if (!pad) offset = (status.st_size - nbytes) + n; pad += (howMany-n); @@ -737,7 +737,7 @@ int ProcessIndex(Volume *vp, VnodeClass class, afs_int32 **Bufp, int *sizep, char buf[SIZEOF_LARGEDISKVNODE], zero[SIZEOF_LARGEDISKVNODE]; register struct VnodeDiskObject *vnode = (struct VnodeDiskObject *) buf; - bzero(zero, sizeof(zero)); /* zero out our proto-vnode */ + memset(zero, 0, sizeof(zero)); /* zero out our proto-vnode */ fdP = IH_OPEN(vp->vnodeIndex[class].handle); if (fdP == NULL) return -1; @@ -782,7 +782,7 @@ int ProcessIndex(Volume *vp, VnodeClass class, afs_int32 **Bufp, int *sizep, if (nVnodes > 0) { Buf = (afs_int32 *) malloc(nVnodes * sizeof(afs_int32)); if (Buf == NULL) return 1; - bzero((char *)Buf, nVnodes * sizeof(afs_int32)); + memset((char *)Buf, 0, nVnodes * sizeof(afs_int32)); STREAM_SEEK(afile, offset = vcp->diskSize, 0); while (1) { code = STREAM_READ(vnode, vcp->diskSize, 1, afile); @@ -916,7 +916,7 @@ static int ReadVnodes(register struct iod *iodp, Volume *vp, V_pref(vp, nearInode); while (tag == D_VNODE) { int haveStuff = 0; - bzero(buf, sizeof (buf)); + memset(buf, 0, sizeof (buf)); if (!ReadInt32(iodp, (afs_uint32 *)&vnodeNumber)) break; diff --git a/src/volser/physio.c b/src/volser/physio.c index ea9a97f..3d5d7ff 100644 --- a/src/volser/physio.c +++ b/src/volser/physio.c @@ -113,7 +113,7 @@ Inode inode; afs_int32 device; { private SalvageCacheCheck = 1; - bzero(dir, sizeof(DirHandle)); + memset(dir, 0, sizeof(DirHandle)); dir->dirh_volume = volume; dir->dirh_device = device; @@ -129,14 +129,14 @@ DirHandle * file; { IH_RELEASE(file->dirh_handle); - bzero(file, sizeof(DirHandle)); + memset(file, 0, sizeof(DirHandle)); } FidZero (file) DirHandle * file; { - bzero(file, sizeof(DirHandle)); + memset(file, 0, sizeof(DirHandle)); } FidEq (afile, bfile) diff --git a/src/volser/restorevol.c b/src/volser/restorevol.c index 0ac48c5..ef73e7c 100644 --- a/src/volser/restorevol.c +++ b/src/volser/restorevol.c @@ -146,7 +146,7 @@ afs_int32 ReadDumpHeader(dh) char tag, c; afs_int32 magic; -/* bzero(&dh, sizeof(dh)); */ +/* memset(&dh, 0, sizeof(dh)); */ magic = ntohl(readvalue(4)); dh->version = ntohl(readvalue(4)); @@ -219,7 +219,7 @@ afs_int32 ReadVolumeHeader(count) int code, i, done, entries; char tag, c; -/* bzero(&vh, sizeof(vh)); */ +/* memset(&vh, 0, sizeof(vh)); */ done = 0; while (!done) { @@ -393,7 +393,7 @@ afs_int32 ReadVNode(count) afs_int32 vnode; afs_int32 mode=0; -/* bzero(&vn, sizeof(vn)); */ +/* memset(&vn, 0, sizeof(vn)); */ vn.dataSize = 0; vn.vnode = 0; vn.parent = 0; diff --git a/src/volser/volmain.c b/src/volser/volmain.c index 48a0be4..760c2ef 100644 --- a/src/volser/volmain.c +++ b/src/volser/volmain.c @@ -342,7 +342,7 @@ usage: } rx_GetIFInfo(); rx_SetRxDeadTime(420); - bzero(busyFlags, sizeof(busyFlags)); + memset(busyFlags, 0, sizeof(busyFlags)); /* Open FileLog and map stdout, stderr into it */ OpenLog(AFSDIR_SERVER_VOLSERLOG_FILEPATH); diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 5dac18f..9810a6a 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -190,7 +190,7 @@ Volume * vp; int code; int length; - bzero(vnode, SIZEOF_LARGEDISKVNODE); + memset(vnode, 0, SIZEOF_LARGEDISKVNODE); V_pref(vp, nearInode); inodeNumber = IH_CREATE(V_linkHandle(vp), V_device(vp), @@ -1146,7 +1146,7 @@ afs_int32 SAFSVolForwardMultiple (acid, fromTrans, fromDate, destinations, int i, nconns, is_incremental; if (results) - bzero(results, sizeof(manyResults)); + memset(results, 0, sizeof(manyResults)); if (!afsconf_SuperUser(tdir, acid, caller)) return VOLSERBAD_ACCESS;/*not a super user*/ @@ -1659,7 +1659,7 @@ struct partEntries *pEntries; partList.partId[j++] = i; } pEntries->partEntries_val = (afs_int32 *) malloc(j * sizeof(int)); - bcopy((char *)&partList, (char *)pEntries->partEntries_val, j * sizeof(int)); + memcpy((char *)pEntries->partEntries_val, (char *)&partList, j * sizeof(int)); pEntries->partEntries_len = j; #else code = stat("/",&rbuf); /*interested in buf->st_dev*/ @@ -1680,7 +1680,7 @@ struct partEntries *pEntries; } } pEntries->partEntries_val = (afs_int32 *) malloc(j * sizeof(int)); - bcopy((char *)&partList, (char *)pEntries->partEntries_val, j * sizeof(int)); + memcpy((char *)pEntries->partEntries_val, (char *)&partList, j * sizeof(int)); pEntries->partEntries_len = j; #endif return 0; @@ -2049,9 +2049,7 @@ afs_int32 VolXListOneVolume (a_rxCidP, a_partID, a_volID, a_volumeXInfoP) /* * Copy out the stat fields in a single operation. */ - bcopy((char *)&(volDiskDataP->stat_reads[0]), - (char *)&(xInfoP->stat_reads[0]), - numStatBytes); + memcpy((char *)&(xInfoP->stat_reads[0]), (char *)&(volDiskDataP->stat_reads[0]), numStatBytes); /* * We're done copying. Detach the volume and iterate (at this @@ -2445,9 +2443,7 @@ afs_int32 VolXListVolumes (a_rxCidP, a_partID, a_flags, a_volumeXInfoP) /* * Copy out the stat fields in a single operation. */ - bcopy((char *)&(volDiskDataP->stat_reads[0]), - (char *)&(xInfoP->stat_reads[0]), - numStatBytes); + memcpy((char *)&(xInfoP->stat_reads[0]), (char *)&(volDiskDataP->stat_reads[0]), numStatBytes); /* * We're done copying. Detach the volume and iterate. diff --git a/src/volser/voltrans.c b/src/volser/voltrans.c index 34ef7d6..2258601 100644 --- a/src/volser/voltrans.c +++ b/src/volser/voltrans.c @@ -46,7 +46,7 @@ afs_int32 apart; { } } tt = (struct volser_trans *) malloc(sizeof(struct volser_trans)); - bzero(tt, sizeof(struct volser_trans)); + memset(tt, 0, sizeof(struct volser_trans)); tt->volid = avol; tt->partition = apart; tt->next = allTrans; diff --git a/src/volser/vos.c b/src/volser/vos.c index 88a1525..806fd03 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -101,7 +101,7 @@ static struct tqHead busyHead, notokHead; static void qInit(ahead) struct tqHead *ahead; { - bzero((char *)ahead, sizeof(struct tqHead)); + memset((char *)ahead, 0, sizeof(struct tqHead)); return; } @@ -216,7 +216,7 @@ char *aname; { } else { th = gethostbyname(aname); if (!th) return 0; - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); } if (addr == htonl(0x7f000001)) { /* local host */ @@ -224,7 +224,7 @@ char *aname; { if (code) return 0; th = gethostbyname(hostname); /* returns host byte order */ if (!th) return 0; - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); } return (addr); @@ -2193,7 +2193,7 @@ register struct cmd_syndesc *as; fprintf(STDOUT,"The partitions on the server are:\n"); for(i = 0 ; i < cnt ; i++){ if(dummyPartList.partFlags[i] & PARTVALID){ - bzero(pname,sizeof(pname)); + memset(pname, 0, sizeof(pname)); MapPartIdIntoName(dummyPartList.partId[i],pname); fprintf(STDOUT," %10s ",pname); total++; @@ -2914,7 +2914,7 @@ register struct cmd_syndesc *as; } /* Zero out search attributes */ - bzero(&attributes,sizeof(struct VldbListByAttributes)); + memset(&attributes, 0, sizeof(struct VldbListByAttributes)); if (as->parms[1].items) { /* -prefix */ strncpy(prefix, as->parms[1].items->data, VOLSER_MAXVOLNAME); @@ -2968,7 +2968,7 @@ register struct cmd_syndesc *as; fflush(STDOUT); /* Get all the VLDB entries on a server and/or partition */ - bzero(&arrayEntries, sizeof(arrayEntries)); + memset(&arrayEntries, 0, sizeof(arrayEntries)); vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries); if (vcode) { fprintf(STDERR,"Could not access the VLDB for attributes\n"); @@ -3144,7 +3144,7 @@ static ListVLDB(as) } for (thisindex = 0; (thisindex != -1); thisindex = nextindex) { - bzero(&arrayEntries, sizeof(arrayEntries)); + memset(&arrayEntries, 0, sizeof(arrayEntries)); centries = 0; nextindex = -1; @@ -3194,8 +3194,7 @@ static ListVLDB(as) tarray = ttarray; /* Copy them in */ - bcopy((char *)arrayEntries.nbulkentries_val, - ((char *)tarray)+tarraysize, parraysize); + memcpy(((char *)tarray)+tarraysize, (char *)arrayEntries.nbulkentries_val, parraysize); tarraysize += parraysize; } } @@ -3247,7 +3246,7 @@ static BackSys(as) char *ccode; int match; - bzero(&attributes,sizeof(struct VldbListByAttributes)); + memset(&attributes, 0, sizeof(struct VldbListByAttributes)); attributes.Mask = 0; seenprefix = (as->parms[0].items ? 1 : 0); @@ -3301,7 +3300,7 @@ static BackSys(as) } } - bzero(&arrayEntries, sizeof(arrayEntries)); /* initialize to hint the stub to alloc space */ + memset(&arrayEntries, 0, sizeof(arrayEntries)); /* initialize to hint the stub to alloc space */ vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries); if (vcode) { fprintf(STDERR,"Could not access the VLDB for attributes\n"); @@ -3510,7 +3509,7 @@ register struct cmd_syndesc *as; } attributes.flag = VLOP_ALLOPERS; attributes.Mask |= VLLIST_FLAG; - bzero(&arrayEntries, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */ + memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */ vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries); if(vcode) { fprintf(STDERR,"Could not access the VLDB for attributes\n"); diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 51ab1c2..6e79773 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -443,7 +443,7 @@ afs_int32 *anewid; tid = 0; aconn = (struct rx_connection *)0; error = 0; - bzero (&tstatus, sizeof(struct volintInfo)); + memset(&tstatus, 0, sizeof(struct volintInfo)); tstatus.dayUse = -1; tstatus.maxquota = aquota; @@ -1955,8 +1955,8 @@ UV_ReleaseVolume(afromvol, afromserver, afrompart, forceflag) int releasecount = 0; struct volser_status volstatus; - bzero((char *)remembertime, sizeof(remembertime)); - bzero((char *)&results, sizeof(results)); + memset((char *)remembertime, 0, sizeof(remembertime)); + memset((char *)&results, 0, sizeof(results)); vcode = ubik_Call(VL_SetLock, cstruct, 0, afromvol, RWVOL, VLOP_RELEASE); if (vcode != VL_RERELEASE) @@ -2147,7 +2147,7 @@ UV_ReleaseVolume(afromvol, afromserver, afrompart, forceflag) strcpy(vname, entry.name); strcat(vname, ".readonly"); - bzero(&cookie,sizeof(cookie)); + memset(&cookie, 0, sizeof(cookie)); strncpy(cookie.name, vname, VOLSER_OLDMAXVOLNAME); cookie.type = ROVOL; cookie.parent = entry.volumeId[RWVOL]; @@ -2161,10 +2161,10 @@ UV_ReleaseVolume(afromvol, afromserver, afrompart, forceflag) if ( !replicas || !times || !! !results.manyResults_val || !toconns ) ONERROR(ENOMEM, 0, "Failed to create transaction on the release clone\n"); - bzero (replicas, (sizeof(struct replica)*nservers+1)); - bzero (times, (sizeof(struct release)*nservers+1)); - bzero (toconns, (sizeof(struct rx_connection *)*nservers+1)); - bzero (results.manyResults_val, (sizeof(afs_int32)*nservers+1)); + memset(replicas, 0, (sizeof(struct replica)*nservers+1)); + memset(times, 0, (sizeof(struct release)*nservers+1)); + memset(toconns, 0, (sizeof(struct rx_connection *)*nservers+1)); + memset(results.manyResults_val, 0, (sizeof(afs_int32)*nservers+1)); /* Create a transaction on the cloned volume */ code = AFSVolTransCreate(fromconn, cloneVolId, afrompart, ITBusy, &fromtid); @@ -2566,7 +2566,7 @@ UV_RestoreVolume(toserver, topart, tovolid, tovolname, flags, WriteData, rock) char apartName[10]; - bzero(&cookie,sizeof(cookie)); + memset(&cookie, 0, sizeof(cookie)); islocked = 0; success = 0; error = 0; @@ -3525,7 +3525,7 @@ static afs_int32 CheckVolume(volumeinfo, aserver, apart, modentry, maxvolid) ERROR_EXIT(code); } - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); vsu_ExtractName(entry.name, volumeinfo->name); /* Store name of RW */ createentry = 1; @@ -4553,7 +4553,7 @@ UV_SyncServer(aserver, apart, flags, force) /* While we need to collect more VLDB entries */ for (si=0; si != -1; si=nsi) { - bzero(&arrayEntries, sizeof(arrayEntries)); + memset(&arrayEntries, 0, sizeof(arrayEntries)); /* Collect set of VLDB entries */ code = VLDB_ListAttributesN2(&attributes, 0, si, diff --git a/src/volser/vsutils.c b/src/volser/vsutils.c index 9f936fd..746656e 100644 --- a/src/volser/vsutils.c +++ b/src/volser/vsutils.c @@ -57,7 +57,7 @@ static void ovlentry_to_nvlentry(oentryp, nentryp) { register int i; - bzero(nentryp, sizeof(struct nvldbentry)); + memset(nentryp, 0, sizeof(struct nvldbentry)); strncpy(nentryp->name, oentryp->name, sizeof(nentryp->name)); for (i=0; i < oentryp->nServers; i++) { nentryp->serverNumber[i] = oentryp->serverNumber[i]; @@ -77,7 +77,7 @@ static nvlentry_to_ovlentry(nentryp, oentryp) { register int i; - bzero(oentryp, sizeof(struct vldbentry)); + memset(oentryp, 0, sizeof(struct vldbentry)); strncpy(oentryp->name, nentryp->name, sizeof(oentryp->name)); if (nentryp->nServers > OMAXNSERVERS) { /* @@ -218,7 +218,7 @@ VLDB_ListAttributes(attrp, entriesp, blkentriesp) if (newvlserver == 1) { tryold: - bzero(&arrayEntries, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */ + memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */ code = ubik_Call(VL_ListAttributes, cstruct, 0, attrp, entriesp, &arrayEntries); if (!code) { blkentriesp->nbulkentries_val = (nvldbentry *)malloc(*entriesp * sizeof(struct nvldbentry)); @@ -306,11 +306,11 @@ VLDB_IsSameAddrs(serv1, serv2, errorp) return 0; } - bzero(&attrs, sizeof(attrs)); + memset(&attrs, 0, sizeof(attrs)); attrs.Mask = VLADDR_IPADDR; attrs.ipaddr = serv1; - bzero(&addrs, sizeof(addrs)); - bzero(&uuid, sizeof(uuid)); + memset(&addrs, 0, sizeof(addrs)); + memset(&uuid, 0, sizeof(uuid)); code = ubik_Call(VL_GetAddrsU, cstruct, 0, &attrs, &uuid, &unique, &nentries, &addrs); if (vlserverv4 == -1) { if (code == RXGEN_OPCODE) { diff --git a/src/xstat/xstat_cm.c b/src/xstat/xstat_cm.c index 0a64028..b139f4b 100644 --- a/src/xstat/xstat_cm.c +++ b/src/xstat/xstat_cm.c @@ -263,8 +263,7 @@ static void xstat_cm_LWP() xstat_cm_Results.collectionNumber = *currCollIDP; xstat_cm_Results.data.AFSCB_CollData_len = AFSCB_MAX_XSTAT_LONGS; - bzero(xstat_cm_Results.data.AFSCB_CollData_val, - AFSCB_MAX_XSTAT_LONGS * 4); + memset(xstat_cm_Results.data.AFSCB_CollData_val, 0, AFSCB_MAX_XSTAT_LONGS * 4); xstat_cm_Results.connP = curr_conn; @@ -474,7 +473,7 @@ int xstat_cm_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, xstat_cm_numCollections = a_numCollections; collIDBytes = xstat_cm_numCollections * sizeof(afs_int32); xstat_cm_collIDP = (afs_int32 *)(malloc(collIDBytes)); - bcopy(a_collIDP, xstat_cm_collIDP, collIDBytes); + memcpy(xstat_cm_collIDP, a_collIDP, collIDBytes); if (xstat_cm_debug) { printf("[%s] Asking for %d collection(s): ", rn, xstat_cm_numCollections); for (curr_srv = 0; curr_srv < xstat_cm_numCollections; curr_srv++) @@ -550,9 +549,7 @@ int xstat_cm_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, (a_socketArray + curr_srv)->sin_addr.s_addr, (a_socketArray + curr_srv)->sin_port); } - bcopy(a_socketArray + curr_srv, - &(curr_conn->skt), - sizeof(struct sockaddr_in)); + memcpy(&(curr_conn->skt), a_socketArray + curr_srv, sizeof(struct sockaddr_in)); hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr); diff --git a/src/xstat/xstat_cm_test.c b/src/xstat/xstat_cm_test.c index e068bd6..3c5d4c9 100644 --- a/src/xstat/xstat_cm_test.c +++ b/src/xstat/xstat_cm_test.c @@ -1282,7 +1282,7 @@ int RunTheTest(a_s) rn, curr_item->data); exit(-1); } - bcopy(he->h_addr, &(CMSktArray[currCM].sin_addr.s_addr), 4); + memcpy(&(CMSktArray[currCM].sin_addr.s_addr), he->h_addr, 4); /* * Move to the next CM name. diff --git a/src/xstat/xstat_fs.c b/src/xstat/xstat_fs.c index 48a8651..79fc915 100644 --- a/src/xstat/xstat_fs.c +++ b/src/xstat/xstat_fs.c @@ -299,8 +299,7 @@ static void xstat_fs_LWP() rn, *currCollIDP); xstat_fs_Results.collectionNumber = *currCollIDP; xstat_fs_Results.data.AFS_CollData_len = AFS_MAX_XSTAT_LONGS; - bzero(xstat_fs_Results.data.AFS_CollData_val, - AFS_MAX_XSTAT_LONGS * 4); + memset(xstat_fs_Results.data.AFS_CollData_val, 0, AFS_MAX_XSTAT_LONGS * 4); xstat_fs_Results.connP = curr_conn; @@ -514,7 +513,7 @@ int xstat_fs_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler xstat_fs_numCollections = a_numCollections; collIDBytes = xstat_fs_numCollections * sizeof(afs_int32); xstat_fs_collIDP = (afs_int32 *)(malloc(collIDBytes)); - bcopy(a_collIDP, xstat_fs_collIDP, collIDBytes); + memcpy(xstat_fs_collIDP, a_collIDP, collIDBytes); if (xstat_fs_debug) { printf("[%s] Asking for %d collection(s): ", rn, xstat_fs_numCollections); for (curr_srv = 0; curr_srv < xstat_fs_numCollections; curr_srv++) @@ -616,9 +615,7 @@ int xstat_fs_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler (a_socketArray + curr_srv)->sin_addr.s_addr, (a_socketArray + curr_srv)->sin_port); } - bcopy(a_socketArray + curr_srv, - &(curr_conn->skt), - sizeof(struct sockaddr_in)); + memcpy(&(curr_conn->skt), a_socketArray + curr_srv, sizeof(struct sockaddr_in)); hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr); diff --git a/src/xstat/xstat_fs_test.c b/src/xstat/xstat_fs_test.c index 0fff760..8547854 100644 --- a/src/xstat/xstat_fs_test.c +++ b/src/xstat/xstat_fs_test.c @@ -709,7 +709,7 @@ int RunTheTest(a_s) rn, curr_item->data); exit(-1); } - bcopy(he->h_addr, &(FSSktArray[currFS].sin_addr.s_addr), 4); + memcpy(&(FSSktArray[currFS].sin_addr.s_addr), he->h_addr, 4); /* * Move to the next File Server name.