fix test program: don't close before writing

set fd to writeable on open for write
This commit is contained in:
kaashoek 2006-08-09 17:25:10 +00:00
parent 6fa5ffb56f
commit 2601de0032
3 changed files with 1 additions and 11 deletions

View file

@ -163,8 +163,6 @@ console_write (int minor, void *buf, int n)
int i; int i;
uchar *b = buf; uchar *b = buf;
cprintf ("print character to console\n");
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
cons_putc((int) b[i]); cons_putc((int) b[i]);
} }

View file

@ -263,6 +263,7 @@ sys_open(void)
iput(ip); iput(ip);
return -1; return -1;
} }
if((ufd = fd_ualloc()) < 0){ if((ufd = fd_ualloc()) < 0){
iput(ip); iput(ip);
fd_close(fd); fd_close(fd);
@ -467,14 +468,6 @@ sys_block(void)
brelse(b); 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); ip = iget(1, 1);
cprintf("iget 1: %d %d %d %d %d %d %d %d\n", cprintf("iget 1: %d %d %d %d %d %d %d %d\n",
ip->dev, ip->inum, ip->count, ip->busy, ip->dev, ip->inum, ip->count, ip->busy,

View file

@ -23,7 +23,6 @@ main(void)
fd = open("console", 1); fd = open("console", 1);
if(fd >= 0){ if(fd >= 0){
puts("open console ok\n"); puts("open console ok\n");
close(fd);
} else { } else {
puts("open console failed!\n"); puts("open console failed!\n");
} }