Print this page
5083 avoid undefined order of operations in assignments
*** 2808,2818 ****
(void) makedir(lost_found_dir, 2);
for (i = DIRBLKSIZ; i < sblock.fs_bsize; i += DIRBLKSIZ) {
bcopy(&lost_found_dir[2], &buf[i], DIRSIZ(&lost_found_dir[2]));
}
node.i_number = LOSTFOUNDINO;
! node.i_smode = node.i_mode = IFDIR | 0700;
node.i_nlink = 2;
node.i_size = sblock.fs_bsize;
node.i_db[0] = alloc((int)node.i_size, node.i_mode);
node.i_blocks = btodb(fragroundup(&sblock, (int)node.i_size));
IRANDOMIZE(&node.i_ic);
--- 2808,2818 ----
(void) makedir(lost_found_dir, 2);
for (i = DIRBLKSIZ; i < sblock.fs_bsize; i += DIRBLKSIZ) {
bcopy(&lost_found_dir[2], &buf[i], DIRSIZ(&lost_found_dir[2]));
}
node.i_number = LOSTFOUNDINO;
! node.i_smode = IFDIR | 0700;
node.i_nlink = 2;
node.i_size = sblock.fs_bsize;
node.i_db[0] = alloc((int)node.i_size, node.i_mode);
node.i_blocks = btodb(fragroundup(&sblock, (int)node.i_size));
IRANDOMIZE(&node.i_ic);
*** 2821,2831 ****
#endif
/*
* create the root directory
*/
node.i_number = UFSROOTINO;
! node.i_mode = node.i_smode = IFDIR | UMASK;
node.i_nlink = PREDEFDIR;
node.i_size = makedir(root_dir, PREDEFDIR);
node.i_db[0] = alloc(sblock.fs_fsize, node.i_mode);
/* i_size < 2GB because we are initializing the file system */
node.i_blocks = btodb(fragroundup(&sblock, (int)node.i_size));
--- 2821,2831 ----
#endif
/*
* create the root directory
*/
node.i_number = UFSROOTINO;
! node.i_mode = IFDIR | UMASK;
node.i_nlink = PREDEFDIR;
node.i_size = makedir(root_dir, PREDEFDIR);
node.i_db[0] = alloc(sblock.fs_fsize, node.i_mode);
/* i_size < 2GB because we are initializing the file system */
node.i_blocks = btodb(fragroundup(&sblock, (int)node.i_size));