vol: use OS_DIRSEP when constructing paths
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 15 Jan 2011 16:47:47 +0000 (11:47 -0500)
committerJeffrey Altman <jaltman@openafs.org>
Sat, 15 Jan 2011 23:01:50 +0000 (15:01 -0800)
Do not assume that / is the directory separator when constructing
paths for internal consumption or log messages.  Use OS_DIRSEP
or OS_DIRSEPC as appropriate.

Change-Id: Ifed618dfa30f2aee27de1ef57de5e504d6701d4d
Reviewed-on: http://gerrit.openafs.org/3669
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/vol/namei_ops.c
src/vol/vol-info.c
src/vol/vol-salvage.c
src/vol/vutil.c
src/volser/restorevol.c
src/volser/vol-dump.c

index 0d734ad..9fc1d63 100644 (file)
@@ -375,12 +375,12 @@ namei_ViceREADME(char *partition)
     int fd;
 
     /* Create the inode directory if we're starting for the first time */
-    (void)afs_snprintf(filename, sizeof filename, "%s/%s", partition,
+    (void)afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s", partition,
                       INODEDIR);
     mkdir(filename, 0700);
 
-    (void)afs_snprintf(filename, sizeof filename, "%s/%s/README", partition,
-                      INODEDIR);
+    (void)afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s" OS_DIRSEP "README",
+                       partition, INODEDIR);
     fd = afs_open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0444);
     if (fd >= 0) {
        (void)write(fd, VICE_README, strlen(VICE_README));
@@ -1777,7 +1777,7 @@ namei_ListAFSFiles(char *dev,
 #else
            if (*dp1->d_name == '.')
                continue;
-           afs_snprintf(path2, sizeof(path2), "%s/%s", name.n_path,
+           afs_snprintf(path2, sizeof(path2), "%s" OS_DIRSEP "%s", name.n_path,
                         dp1->d_name);
            dirp2 = opendir(path2);
            if (dirp2) {
@@ -1870,7 +1870,7 @@ _namei_examine_special(char * path1,
        /* VGID encoded in linktable filename and/or OGM data isn't
         * consistent with VGID encoded in namei path */
        Log("namei_ListAFSSubDirs: warning: inconsistent linktable "
-           "filename \"%s/%s\"; salvager will delete it "
+           "filename \"%s" OS_DIRSEP "%s\"; salvager will delete it "
            "(dir_vgid=%u, inode_vgid=%u, ogm_vgid=%u)\n",
            path1, dname, myIH->ih_vid,
            (unsigned int)inode_vgid,
@@ -1879,7 +1879,7 @@ _namei_examine_special(char * path1,
        char path2[512];
        /* Open this handle */
        (void)afs_snprintf(path2, sizeof(path2),
-                          "%s/%s", path1, dname);
+                          "%s" OS_DIRSEP "%s", path1, dname);
        linkHandle->fd_fd = afs_open(path2, Testing ? O_RDONLY : O_RDWR, 0666);
        info.linkCount =
            namei_GetLinkCount(linkHandle, (Inode) 0, 1, 1, Testing);
@@ -1952,7 +1952,7 @@ _namei_examine_reg(char * path3,
                            info.inodeNumber, 1, 1, Testing);
     if (info.linkCount == 0) {
 #ifdef DELETE_ZLC
-       Log("Found 0 link count file %s/%s, deleting it.\n", path3, dname);
+       Log("Found 0 link count file %s" OS_DIRSEP "%s, deleting it.\n", path3, dname);
 #ifdef AFS_SALSRV_ENV
        /* defer -- the AddToZLCDeleteList() interface is not MT-safe */
        ret = -2;
@@ -1960,7 +1960,7 @@ _namei_examine_reg(char * path3,
        AddToZLCDeleteList((char)i, dname);
 #endif /* !AFS_SALSRV_ENV */
 #else /* !DELETE_ZLC */
-       Log("Found 0 link count file %s/%s.\n", path3,
+       Log("Found 0 link count file %s" OS_DIRSEP "%s.\n", path3,
            dname);
 #endif
        goto error;
@@ -2458,7 +2458,7 @@ namei_ListAFSSubDirs(IHandle_t * dirIH,
 
 #ifndef AFS_NT40_ENV /* This level missing on Windows */
            /* Now we've got a next level subdir. */
-           afs_snprintf(path2, sizeof(path2), "%s/%s", path1, dp1->d_name);
+           afs_snprintf(path2, sizeof(path2), "%s" OS_DIRSEP "%s", path1, dp1->d_name);
            dirp2 = opendir(path2);
            if (dirp2) {
                while ((dp2 = readdir(dirp2))) {
@@ -2466,7 +2466,7 @@ namei_ListAFSSubDirs(IHandle_t * dirIH,
                        continue;
 
                    /* Now we've got to the actual data */
-                   afs_snprintf(path3, sizeof(path3), "%s/%s", path2,
+                   afs_snprintf(path3, sizeof(path3), "%s" OS_DIRSEP "%s", path2,
                                 dp2->d_name);
 #else
                    /* Now we've got to the actual data */
@@ -2680,7 +2680,7 @@ DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info,
     int parm, tag;
     lb64_string_t check;
 
-    afs_snprintf(fpath, sizeof(fpath), "%s/%s", dpath, name);
+    afs_snprintf(fpath, sizeof(fpath), "%s" OS_DIRSEP "%s", dpath, name);
 
     if (afs_stat(fpath, &status) < 0) {
        return -1;
@@ -2850,14 +2850,14 @@ namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId)
            continue;
 #endif
        if (DecodeInode(dir_name, dp->d_name, &info, ih->ih_vid) < 0) {
-           Log("1 namei_ConvertROtoRWvolume: DecodeInode failed for %s/%s\n",
+           Log("1 namei_ConvertROtoRWvolume: DecodeInode failed for %s" OS_DIRSEP "%s\n",
                dir_name, dp->d_name);
            closedir(dirp);
            code = -1;
            goto done;
        }
        if (info.u.param[1] != -1) {
-           Log("1 namei_ConvertROtoRWvolume: found other than volume special file %s/%s\n", dir_name, dp->d_name);
+           Log("1 namei_ConvertROtoRWvolume: found other than volume special file %s" OS_DIRSEP "%s\n", dir_name, dp->d_name);
            closedir(dirp);
            code = -1;
            goto done;
@@ -2869,7 +2869,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId)
                    continue;
                }
            }
-           Log("1 namei_ConvertROtoRWvolume: found special file %s/%s"
+           Log("1 namei_ConvertROtoRWvolume: found special file %s" OS_DIRSEP "%s"
                " for volume %lu\n", dir_name, dp->d_name,
                afs_printable_uint32_lu(info.u.param[0]));
            closedir(dirp);
@@ -2887,7 +2887,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId)
            largeSeen = 1;
        } else {
            closedir(dirp);
-           Log("1 namei_ConvertROtoRWvolume: unknown type %d of special file found : %s/%s\n", info.u.param[2], dir_name, dp->d_name);
+           Log("1 namei_ConvertROtoRWvolume: unknown type %d of special file found : %s" OS_DIRSEP "%s\n", info.u.param[2], dir_name, dp->d_name);
            code = -1;
            goto done;
        }
index b653af3..ab51e59 100644 (file)
@@ -457,7 +457,7 @@ HandleVolume(struct DiskPartition64 *dp, char *name)
     } else {
        afs_int32 n;
 
-       (void)afs_snprintf(headerName, sizeof headerName, "%s/%s",
+       (void)afs_snprintf(headerName, sizeof headerName, "%s" OS_DIRSEP "%s",
                           VPartitionPath(dp), name);
        if ((fd = afs_open(headerName, O_RDONLY)) == -1
            || afs_fstat(fd, &status) == -1) {
index 138bf05..599a9bf 100644 (file)
@@ -958,7 +958,7 @@ void
 DeleteExtraVolumeHeaderFile(struct SalvInfo *salvinfo, struct VolumeSummary *vsp)
 {
     char path[64];
-    sprintf(path, "%s/%s", salvinfo->fileSysPath, vsp->fileName);
+    sprintf(path, "%s" OS_DIRSEP "%s", salvinfo->fileSysPath, vsp->fileName);
 
     if (!Showmode)
        Log("The volume header file %s is not associated with any actual data (%sdeleted)\n", path, (Testing ? "would have been " : ""));
@@ -2275,7 +2275,7 @@ SalvageVolumeHeaderFile(struct SalvInfo *salvinfo, struct InodeSummary *isp,
        char path[64];
        char headerName[64];
        (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_printable_uint32_lu(isp->volumeId));
-       (void)afs_snprintf(path, sizeof path, "%s/%s", salvinfo->fileSysPath, headerName);
+       (void)afs_snprintf(path, sizeof path, "%s" OS_DIRSEP "%s", salvinfo->fileSysPath, headerName);
        if (check) {
            Log("No header file for volume %u\n", isp->volumeId);
            return -1;
@@ -2306,7 +2306,7 @@ SalvageVolumeHeaderFile(struct SalvInfo *salvinfo, struct InodeSummary *isp,
                (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_printable_uint32_lu(isp->volumeId));
                isp->volSummary->fileName = ToString(headerName);
            }
-           (void)afs_snprintf(path, sizeof path, "%s/%s", salvinfo->fileSysPath, headerName);
+           (void)afs_snprintf(path, sizeof path, "%s" OS_DIRSEP "%s", salvinfo->fileSysPath, headerName);
 
            Log("Header file %s is damaged or no longer valid%s\n", path,
                (check ? "" : "; repairing"));
@@ -2958,7 +2958,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber,
     vnodeEssence = CheckVnodeNumber(salvinfo, vnodeNumber);
     if (vnodeEssence == NULL) {
        if (!Showmode) {
-           Log("dir vnode %u: invalid entry deleted: %s/%s (vnode %u, unique %u)\n", dir->vnodeNumber, dir->name ? dir->name : "??", name, vnodeNumber, unique);
+           Log("dir vnode %u: invalid entry deleted: %s" OS_DIRSEP "%s (vnode %u, unique %u)\n", dir->vnodeNumber, dir->name ? dir->name : "??", name, vnodeNumber, unique);
        }
        if (!Testing) {
            CopyOnWrite(salvinfo, dir);
@@ -2973,7 +2973,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber,
      * the machine.
      */
     if (vnodeEssence->InodeNumber == 0) {
-       Log("dir vnode %d: invalid entry: %s/%s has no inode (vnode %d, unique %d)%s\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique, (Testing ? "-- would have deleted" : " -- deleted"));
+       Log("dir vnode %d: invalid entry: %s" OS_DIRSEP "%s has no inode (vnode %d, unique %d)%s\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique, (Testing ? "-- would have deleted" : " -- deleted"));
        if (!Testing) {
            CopyOnWrite(salvinfo, dir);
            osi_Assert(Delete(&dir->dirHandle, name) == 0);
@@ -2986,7 +2986,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber,
     if (!(vnodeNumber & 1) && !Showmode
        && !(vnodeEssence->count || vnodeEssence->unique
             || vnodeEssence->modeBits)) {
-       Log("dir vnode %u: invalid entry: %s/%s (vnode %u, unique %u)%s\n",
+       Log("dir vnode %u: invalid entry: %s" OS_DIRSEP "%s (vnode %u, unique %u)%s\n",
            dir->vnodeNumber, (dir->name ? dir->name : "??"), name,
            vnodeNumber, unique,
            ((!unique) ? (Testing ? "-- would have deleted" : " -- deleted") :
@@ -3017,7 +3017,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber,
        todelete = ((!vnodeEssence->unique || dirOrphaned) ? 1 : 0);
 
        if (!Showmode) {
-           Log("dir vnode %u: %s/%s (vnode %u): unique changed from %u to %u %s\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique, vnodeEssence->unique, (!todelete ? "" : (Testing ? "-- would have deleted" : "-- deleted")));
+           Log("dir vnode %u: %s" OS_DIRSEP "%s (vnode %u): unique changed from %u to %u %s\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique, vnodeEssence->unique, (!todelete ? "" : (Testing ? "-- would have deleted" : "-- deleted")));
        }
        if (!Testing) {
            AFSFid fid;
@@ -3089,7 +3089,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber,
        return 0;
     } else {
        if (ShowSuid && (vnodeEssence->modeBits & 06000))
-           Log("FOUND suid/sgid file: %s/%s (%u.%u %05o) author %u (vnode %u dir %u)\n", dir->name ? dir->name : "??", name, vnodeEssence->owner, vnodeEssence->group, vnodeEssence->modeBits, vnodeEssence->author, vnodeNumber, dir->vnodeNumber);
+           Log("FOUND suid/sgid file: %s" OS_DIRSEP "%s (%u.%u %05o) author %u (vnode %u dir %u)\n", dir->name ? dir->name : "??", name, vnodeEssence->owner, vnodeEssence->group, vnodeEssence->modeBits, vnodeEssence->author, vnodeNumber, dir->vnodeNumber);
        if (/* ShowMounts && */ (vnodeEssence->type == vSymlink)
            && !(vnodeEssence->modeBits & 0111)) {
            ssize_t nBytes;
@@ -3120,12 +3120,12 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber,
            if (nBytes == size) {
                buf[size] = '\0';
                if ( (*buf != '#' && *buf != '%') || buf[strlen(buf)-1] != '.' ) {
-                   Log("Volume %u (%s) mount point %s/%s to '%s' invalid, %s to symbolic link\n",
+                   Log("Volume %u (%s) mount point %s" OS_DIRSEP "%s to '%s' invalid, %s to symbolic link\n",
                        dir->dirHandle.dirh_handle->ih_vid, dir->vname, dir->name ? dir->name : "??", name, buf,
                        Testing ? "would convert" : "converted");
                    vnodeEssence->modeBits |= 0111;
                    vnodeEssence->changed = 1;
-               } else if (ShowMounts) Log("In volume %u (%s) found mountpoint %s/%s to '%s'\n",
+               } else if (ShowMounts) Log("In volume %u (%s) found mountpoint %s" OS_DIRSEP "%s to '%s'\n",
                    dir->dirHandle.dirh_handle->ih_vid, dir->vname,
                    dir->name ? dir->name : "??", name, buf);
            } else {
@@ -3136,7 +3136,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber,
            IH_RELEASE(ihP);
        }
        if (ShowRootFiles && vnodeEssence->owner == 0 && vnodeNumber != 1)
-           Log("FOUND root file: %s/%s (%u.%u %05o) author %u (vnode %u dir %u)\n", dir->name ? dir->name : "??", name, vnodeEssence->owner, vnodeEssence->group, vnodeEssence->modeBits, vnodeEssence->author, vnodeNumber, dir->vnodeNumber);
+           Log("FOUND root file: %s" OS_DIRSEP "%s (%u.%u %05o) author %u (vnode %u dir %u)\n", dir->name ? dir->name : "??", name, vnodeEssence->owner, vnodeEssence->group, vnodeEssence->modeBits, vnodeEssence->author, vnodeNumber, dir->vnodeNumber);
        if (vnodeIdToClass(vnodeNumber) == vLarge
            && vnodeEssence->name == NULL) {
            char *n;
@@ -3159,7 +3159,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber,
                 * another non-orphaned dir).
                 */
                if (!Showmode) {
-                   Log("dir vnode %u: %s/%s (vnode %u, unique %u) -- parent vnode %schanged from %u to %u\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique, (Testing ? "would have been " : ""), vnodeEssence->parent, dir->vnodeNumber);
+                   Log("dir vnode %u: %s" OS_DIRSEP "%s (vnode %u, unique %u) -- parent vnode %schanged from %u to %u\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique, (Testing ? "would have been " : ""), vnodeEssence->parent, dir->vnodeNumber);
                }
                vnodeEssence->parent = dir->vnodeNumber;
                vnodeEssence->changed = 1;
@@ -3167,11 +3167,11 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber,
                /* Vnode was claimed by another directory */
                if (!Showmode) {
                    if (dirOrphaned) {
-                       Log("dir vnode %u: %s/%s parent vnode is %u (vnode %u, unique %u) -- %sdeleted\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeEssence->parent, vnodeNumber, unique, (Testing ? "would have been " : ""));
+                       Log("dir vnode %u: %s" OS_DIRSEP "%s parent vnode is %u (vnode %u, unique %u) -- %sdeleted\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeEssence->parent, vnodeNumber, unique, (Testing ? "would have been " : ""));
                    } else if (vnodeNumber == 1) {
-                       Log("dir vnode %d: %s/%s is invalid (vnode %d, unique %d) -- %sdeleted\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique, (Testing ? "would have been " : ""));
+                       Log("dir vnode %d: %s" OS_DIRSEP "%s is invalid (vnode %d, unique %d) -- %sdeleted\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique, (Testing ? "would have been " : ""));
                    } else {
-                       Log("dir vnode %u: %s/%s already claimed by directory vnode %u (vnode %u, unique %u) -- %sdeleted\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeEssence->parent, vnodeNumber, unique, (Testing ? "would have been " : ""));
+                       Log("dir vnode %u: %s" OS_DIRSEP "%s already claimed by directory vnode %u (vnode %u, unique %u) -- %sdeleted\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeEssence->parent, vnodeNumber, unique, (Testing ? "would have been " : ""));
                    }
                }
                if (!Testing) {
@@ -4174,7 +4174,7 @@ MaybeZapVolume(struct SalvInfo *salvinfo, struct InodeSummary *isp,
            if (!Testing) {
                afs_int32 code;
                char path[64];
-               sprintf(path, "%s/%s", salvinfo->fileSysPath, isp->volSummary->fileName);
+               sprintf(path, "%s" OS_DIRSEP "%s", salvinfo->fileSysPath, isp->volSummary->fileName);
 
                code = VDestroyVolumeDiskHeader(salvinfo->fileSysPartition, isp->volumeId, isp->RWvolumeId);
                if (code) {
index 967a3ac..d08b554 100644 (file)
@@ -190,7 +190,7 @@ VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId)
     vol.stamp.version = VOLUMEINFOVERSION;
     vol.destroyMe = DESTROY_ME;
     (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_printable_uint32_lu(vol.id));
-    (void)afs_snprintf(volumePath, sizeof volumePath, "%s/%s",
+    (void)afs_snprintf(volumePath, sizeof volumePath, "%s" OS_DIRSEP "%s",
                       VPartitionPath(partition), headerName);
     rc = stat(volumePath, &st);
     if (rc == 0 || errno != ENOENT) {
@@ -270,7 +270,7 @@ VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId)
        }
        if (FDH_PWRITE(fdP, (char *)&p->stamp, sizeof(p->stamp), 0) !=
            sizeof(p->stamp)) {
-           Log("VCreateVolume:  Problem writing to  inode %s (err=%d)\n",
+           Log("VCreateVolume:  Problem writing to inode %s (err=%d)\n",
                PrintInode(stmp, *(p->inode)), errno);
            FDH_REALLYCLOSE(fdP);
            goto bad;
@@ -418,7 +418,7 @@ VReadVolumeDiskHeader(VolumeId volid,
     char path[MAXPATHLEN];
 
     (void)afs_snprintf(path, sizeof(path),
-                      "%s/" VFORMAT,
+                      "%s" OS_DIRSEP VFORMAT,
                       VPartitionPath(dp), afs_printable_uint32_lu(volid));
     fd = open(path, O_RDONLY);
     if (fd < 0) {
@@ -474,7 +474,7 @@ _VWriteVolumeDiskHeader(VolumeDiskHeader_t * hdr,
     flags |= O_RDWR;
 
     (void)afs_snprintf(path, sizeof(path),
-                      "%s/" VFORMAT,
+                      "%s" OS_DIRSEP VFORMAT,
                       VPartitionPath(dp), afs_printable_uint32_lu(hdr->id));
     fd = open(path, flags, 0644);
     if (fd < 0) {
@@ -654,7 +654,7 @@ VDestroyVolumeDiskHeader(struct DiskPartition64 * dp,
 #endif /* AFS_DEMAND_ATTACH_FS */
 
     (void)afs_snprintf(path, sizeof(path),
-                       "%s/" VFORMAT,
+                       "%s" OS_DIRSEP VFORMAT,
                        VPartitionPath(dp), afs_printable_uint32_lu(volid));
     code = unlink(path);
     if (code) {
@@ -825,7 +825,7 @@ VWalkVolumeHeaders(struct DiskPartition64 *dp, const char *partpath,
        if (p != NULL && strcmp(p, VHDREXT) == 0) {
            char name[VMAXPATHLEN];
 
-           sprintf(name, "%s/%s", partpath, dentry->d_name);
+           sprintf(name, "%s" OS_DIRSEP "%s", partpath, dentry->d_name);
 
            code = _VHandleVolumeHeader(dp, volfunc, name, &diskHeader, -1, rock);
            if (code < 0) {
index 4862aac..f8f198e 100644 (file)
@@ -474,7 +474,7 @@ ReadVNode(afs_int32 count)
            if (vnode == 1)
                strncpy(parentdir, rootdir, sizeof parentdir);
            else {
-               afs_snprintf(parentdir, sizeof parentdir, "%s/%s%d", rootdir,
+               afs_snprintf(parentdir, sizeof parentdir, "%s" OS_DIRSEP "%s%d", rootdir,
                             ADIR, vnode);
 
                len = readlink(parentdir, linkname, MAXNAMELEN);
@@ -482,7 +482,7 @@ ReadVNode(afs_int32 count)
                    /* parentdir does not exist. So create an orphan dir.
                     * and then link the parentdir to the orphaned dir.
                     */
-                   afs_snprintf(linkname, sizeof linkname, "%s/%s%d",
+                   afs_snprintf(linkname, sizeof linkname, "%s" OS_DIRSEP "%s%d",
                                 rootdir, ODIR, vnode);
                    code = mkdir(linkname, 0777);
                    if ((code < 0) && (errno != EEXIST)) {
@@ -575,9 +575,9 @@ ReadVNode(afs_int32 count)
                                /* dirname is the directory to create.
                                 * vflink is what will link to it.
                                 */
-                               afs_snprintf(dirname, sizeof dirname, "%s/%s",
+                               afs_snprintf(dirname, sizeof dirname, "%s" OS_DIRSEP "%s",
                                             parentdir, this_name);
-                           afs_snprintf(vflink, sizeof vflink, "%s/%s%d",
+                           afs_snprintf(vflink, sizeof vflink, "%s" OS_DIRSEP "%s%d",
                                         rootdir, ADIR, this_vn);
 
                            /* The link and directory may already exist */
@@ -597,7 +597,7 @@ ReadVNode(afs_int32 count)
                                 * It was created originally as orphaned.
                                 */
                                linkname[len - 1] = '\0';       /* remove '/' at end */
-                               afs_snprintf(lname, sizeof lname, "%s/%s",
+                               afs_snprintf(lname, sizeof lname, "%s" OS_DIRSEP "%s",
                                             rootdir, linkname);
                                code = rename(lname, dirname);
                                if (code) {
@@ -631,7 +631,7 @@ ReadVNode(afs_int32 count)
                            else {
                             /*AFILEENTRY*/ afs_snprintf(vflink,
                                                         sizeof vflink,
-                                                        "%s/%s%d", parentdir,
+                                                        "%s" OS_DIRSEP "%s%d", parentdir,
                                                         AFILE, this_vn);
 
                            code = symlink(this_name, vflink);
@@ -660,11 +660,11 @@ ReadVNode(afs_int32 count)
                 * then the file will be an orphaned file.
                 */
                lfile = 1;
-               afs_snprintf(filename, sizeof filename, "%s/%s%d", parentdir,
+               afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s%d", parentdir,
                             AFILE, vn.vnode);
                len = readlink(filename, fname, MAXNAMELEN);
                if (len < 0) {
-                   afs_snprintf(filename, sizeof filename, "%s/%s%d",
+                   afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s%d",
                                 rootdir, OFILE, vn.vnode);
                    lfile = 0;  /* no longer a linked file; a direct path */
                }
@@ -726,15 +726,15 @@ ReadVNode(afs_int32 count)
                 * of the symbolic link. If it doesn't exist,
                 * then the link will be an orphaned link.
                 */
-               afs_snprintf(linkname, sizeof linkname, "%s/%s%d", parentdir,
+               afs_snprintf(linkname, sizeof linkname, "%s" OS_DIRSEP "%s%d", parentdir,
                             AFILE, vn.vnode);
                len = readlink(linkname, fname, MAXNAMELEN);
                if (len < 0) {
-                   afs_snprintf(filename, sizeof filename, "%s/%s%d",
+                   afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s%d",
                                 rootdir, OFILE, vn.vnode);
                } else {
                    fname[len] = '\0';
-                   afs_snprintf(filename, sizeof filename, "%s/%s",
+                   afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s",
                                 parentdir, fname);
                }
 
@@ -922,19 +922,19 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
        dirP = opendir(rootdir);
        while (dirP && (dirE = readdir(dirP))) {
            if (strncmp(dirE->d_name, ADIR, strlen(ADIR)) == 0) {
-               afs_snprintf(name, sizeof name, "%s/%s", rootdir,
+               afs_snprintf(name, sizeof name, "%s" OS_DIRSEP "%s", rootdir,
                             dirE->d_name);
                dirQ = opendir(name);
                while (dirQ && (dirF = readdir(dirQ))) {
                    if (strncmp(dirF->d_name, AFILE, strlen(AFILE)) == 0) {
-                       afs_snprintf(name, sizeof name, "%s/%s/%s", rootdir,
+                       afs_snprintf(name, sizeof name, "%s" OS_DIRSEP "%s/%s", rootdir,
                                     dirE->d_name, dirF->d_name);
                        unlink(name);
                    }
                }
                closedir(dirQ);
            } else if (strncmp(dirE->d_name, AFILE, strlen(AFILE)) == 0) {
-               afs_snprintf(name, sizeof name, "%s/%s", rootdir,
+               afs_snprintf(name, sizeof name, "%s" OS_DIRSEP "%s", rootdir,
                             dirE->d_name);
                unlink(name);
            }
@@ -946,7 +946,7 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
     dirP = opendir(rootdir);
     while (dirP && (dirE = readdir(dirP))) {
        if (strncmp(dirE->d_name, ADIR, strlen(ADIR)) == 0) {
-           afs_snprintf(name, sizeof name, "%s/%s", rootdir, dirE->d_name);
+           afs_snprintf(name, sizeof name, "%s" OS_DIRSEP "%s", rootdir, dirE->d_name);
            unlink(name);
        }
     }
index 5cb057c..912f0b4 100644 (file)
@@ -260,7 +260,7 @@ HandleVolume(struct DiskPartition64 *dp, char *name, char *filename, int fromtim
 
     afs_int32 n;
 
-    (void)afs_snprintf(headerName, sizeof headerName, "%s/%s",
+    (void)afs_snprintf(headerName, sizeof headerName, "%s" OS_DIRSEP "%s",
                       VPartitionPath(dp), name);
     if ((fd = afs_open(headerName, O_RDONLY)) == -1
        || afs_fstat(fd, &status) == -1) {