Path: utzoo!attcan!uunet!mcvax!hp4nl!philmds!prle!cst!meulenbr From: meulenbr@cst.UUCP (Frans Meulenbroeks) Newsgroups: comp.os.minix Subject: fopen/fclose bug + fix Message-ID: <259@cst.UUCP> Date: 11 Nov 88 18:37:16 GMT Reply-To: meulenbr@cst.UUCP (Frans Meulenbroeks) Organization: Centre for Software Technology, Philips Eindhoven Lines: 88 Hi! I've found a minor bug in fopen/fclose. 0 is used for assignment and comparison against _io_table, while (FILE *)0 would be better. I think it is cleaner to fix printdat.c as well. However, I don't know for sure if this is really needed. The bug applies to Minix/ST. PC people should check out for themselves whether or not this is appropriate. Fixes (cdiffs) are at the end. Frans Meulenbroeks (signature at end) # This is a shell archive. # Remove everything above and including the cut line. # Then run the rest of the file through sh. -----cut here-----cut here-----cut here-----cut here----- #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # fclose.cdiff # fopen.cdiff # printdat.cdiff # This archive created: Fri Nov 11 19:32:53 1988 sed 's/^X//' << \SHAR_EOF > fclose.cdiff X*** ../lib/fclose.c Tue Mar 1 21:37:18 1988 X--- ./fclose.c Sat Nov 12 01:31:32 1988 X*************** X*** 7,13 **** X X for (i=0; i= NFILES) X--- 7,13 ---- X X for (i=0; i= NFILES) SHAR_EOF sed 's/^X//' << \SHAR_EOF > fopen.cdiff X*** ../lib/fopen.c Tue Mar 1 21:37:20 1988 X--- ./fopen.c Sat Nov 12 01:31:16 1988 X*************** X*** 12,18 **** X int fd, X flags = 0; X X! for (i = 0; _io_table[i] != 0 ; i++) X if ( i >= NFILES ) X return(NULL); X X--- 12,18 ---- X int fd, X flags = 0; X X! for (i = 0; _io_table[i] != (FILE *)0 ; i++) X if ( i >= NFILES ) X return(NULL); X SHAR_EOF sed 's/^X//' << \SHAR_EOF > printdat.cdiff X*** ../lib/printdat.c Tue Mar 1 21:37:38 1988 X--- ./printdat.c Sat Nov 12 01:31:46 1988 X*************** X*** 19,23 **** X &_stdin, X &_stdout, X &_stderr, X! 0 X }; X--- 19,23 ---- X &_stdin, X &_stdout, X &_stderr, X! (FILE *)0 X }; SHAR_EOF # End of shell archive exit 0 -- Frans Meulenbroeks (meulenbr@cst.prl.philips.nl) Centre for Software Technology ( or try: ...!mcvax!philmds!prle!cst!meulenbr)