fix test program: don't close before writing
set fd to writeable on open for write
This commit is contained in:
parent
6fa5ffb56f
commit
2601de0032
3 changed files with 1 additions and 11 deletions
|
@ -163,8 +163,6 @@ console_write (int minor, void *buf, int n)
|
|||
int i;
|
||||
uchar *b = buf;
|
||||
|
||||
cprintf ("print character to console\n");
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
cons_putc((int) b[i]);
|
||||
}
|
||||
|
|
|
@ -263,6 +263,7 @@ sys_open(void)
|
|||
iput(ip);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((ufd = fd_ualloc()) < 0){
|
||||
iput(ip);
|
||||
fd_close(fd);
|
||||
|
@ -467,14 +468,6 @@ sys_block(void)
|
|||
brelse(b);
|
||||
}
|
||||
|
||||
#if 0
|
||||
cprintf("overwrite fs.img!\n");
|
||||
b = getblk();
|
||||
memset (b->data, 'f', 10);
|
||||
bwrite(1, b, 0);
|
||||
cprintf("write is done\n");
|
||||
#endif
|
||||
|
||||
ip = iget(1, 1);
|
||||
cprintf("iget 1: %d %d %d %d %d %d %d %d\n",
|
||||
ip->dev, ip->inum, ip->count, ip->busy,
|
||||
|
|
1
userfs.c
1
userfs.c
|
@ -23,7 +23,6 @@ main(void)
|
|||
fd = open("console", 1);
|
||||
if(fd >= 0){
|
||||
puts("open console ok\n");
|
||||
close(fd);
|
||||
} else {
|
||||
puts("open console failed!\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue