continue;
if (inodeFile != INVALID_FD) {
- if (OS_WRITE(inodeFile, &info, sizeof(info) * 1) != 1) {
+ if (OS_WRITE(inodeFile, &info, sizeof(info)) != sizeof(info)) {
Log("Error writing inode file for partition %s\n", partition);
goto out;
}
if (inodeFile != INVALID_FD) {
if (OS_WRITE
(inodeFile, &info.ili_info, sizeof(vice_inode_info_t))
- != 1) {
+ != sizeof(vice_inode_info_t)) {
Log("Error writing inode file for partition %s\n", mountedOn);
goto err1_exit;
}
if (judgeInode && (*judgeInode) (&info, judgeParam, rock) == 0)
continue;
if (inodeFile != INVALID_FD) {
- if (OS_WRITE(inodeFile, &info, sizeof(info)) != 1) {
+ if (OS_WRITE(inodeFile, &info, sizeof(info)) != sizeof(info)) {
Log("Error writing inode file for partition %s\n", partition);
goto out;
}
if (judgeInode && (*judgeInode) (&info, judgeParam, rock) == 0)
continue;
if (inodeFile != INVALID_FD) {
- if (OS_WRITE(inodeFile, &info, sizeof(info)) != 1) {
+ if (OS_WRITE(inodeFile, &info, sizeof(info)) != sizeof(info)) {
Log("Error writing inode file for partition %s\n",
partition);
goto out;
{
size_t n;
n = OS_WRITE(fp, info, sizeof(*info));
- return (n == 1) ? 0 : -2;
+ return (n == sizeof(*info)) ? 0 : -2;
}
/*
* Paranoia: check that the file is really the right size
*/
- if (OS_SIZE(inodeFile) * sizeof(struct ViceInodeInfo)) {
+ if (OS_SIZE(inodeFile) != ninodes * sizeof(struct ViceInodeInfo)) {
Log("Wrong size (%d instead of %lu) in inode file for %s\n",
(int) OS_SIZE(inodeFile),
(long unsigned int) ninodes * sizeof(struct ViceInodeInfo),
getpid());
#endif
- inodeFile = OS_OPEN(inodeListPath, O_RDWR|O_TRUNC, 0666);
+ inodeFile = OS_OPEN(inodeListPath, O_RDWR|O_TRUNC|O_CREAT, 0666);
if (inodeFile == INVALID_FD) {
Abort("Error %d when creating inode description file %s; not salvaged\n", errno, inodeListPath);
}
(void)afs_snprintf(summaryFileName, sizeof summaryFileName,
"%s" OS_DIRSEP "salvage.temp.%d", tdir, getpid());
#endif
- summaryFile = OS_OPEN(summaryFileName, O_RDWR|O_APPEND, 0666);
+ summaryFile = OS_OPEN(summaryFileName, O_RDWR|O_APPEND|O_CREAT, 0666);
if (summaryFile == INVALID_FD) {
Abort("Unable to create inode summary file\n");
}