return(EINVAL);
if (newsize > rip->i_sp->s_max_size) /* don't let inode grow too big */
return(EFBIG);
+ if (rip->i_size == newsize)
+ return(OK);
/* Free the actual space if truncating. */
if (newsize < rip->i_size) {
file_type = rip->i_mode & I_TYPE; /* check to see if file is special */
if (file_type == I_CHAR_SPECIAL || file_type == I_BLOCK_SPECIAL)
return(EINVAL);
- if(newsize > rip->i_sp->s_max_size) /* don't let inode grow too big */
+ if (rip->i_size == newsize)
+ return(OK);
+ if (newsize > rip->i_sp->s_max_size) /* don't let inode grow too big */
return(EFBIG);
/* Free the actual space if truncating. */
- if(newsize < rip->i_size) {
+ if (newsize < rip->i_size) {
if ((r = freesp_inode(rip, newsize, rip->i_size)) != OK)
return(r);
}
/* Clear the rest of the last zone if expanding. */
- if(newsize > rip->i_size) clear_zone(rip, rip->i_size, 0);
+ if (newsize > rip->i_size) clear_zone(rip, rip->i_size, 0);
/* Next correct the inode size. */
rip->i_size = newsize;
if (unlink("T16.i1") != 0) e(84);
if (unlink("T16.j") != 0) e(85);
if (unlink("T16.k") != 0) e(86);
+
+ /* Test the times for truncate. */
+ if (system("echo 1 > T16.l") != 0) e(87);
+ stat("T16.l", &s);
+ get_times("T16.l", &a, &c, &m);
+ sleep(1);
+ truncate("T16.l", s.st_size);
+ get_times("T16.l", &ta, &tc, &tm);
+ if (a != ta || c != tc || m != tm) e(88);
}
void get_times(name, a, c, m)