Path: utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!SM.UNISYS.COM!eggert From: eggert@SM.UNISYS.COM (Paul Eggert) Newsgroups: gnu.utils.bug Subject: GNU diff 1.4 bug fix: typo in test for directories Message-ID: <8811030304.AA11039@sea.sm.unisys.com> Date: 3 Nov 88 03:04:30 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 27 GNU diff 1.4 does not correctly test whether a file is a directory. The code says (S_IFDIR == (mode & S_IFDIR)) where it should say (S_IFDIR == (mode & S_IFMT)). The bug is rarely exercised because (under SunOS 4.0, anyway) only block special files and sockets are mishandled. Here is a fix. *** 1.4/diff.c Wed Nov 2 18:59:24 1988 --- fix/diff.c Wed Nov 2 18:56:31 1988 *************** *** 381,383 **** else ! inf[i].dir_p = (S_IFDIR == (inf[i].stat.st_mode & S_IFDIR)); } --- 381,383 ---- else ! inf[i].dir_p = (S_IFDIR == (inf[i].stat.st_mode & S_IFMT)); } *************** *** 484,486 **** inf[dir_arg].dir_p ! = (S_IFDIR == (inf[dir_arg].stat.st_mode & S_IFDIR)); if (inf[dir_arg].dir_p) --- 484,486 ---- inf[dir_arg].dir_p ! = (S_IFDIR == (inf[dir_arg].stat.st_mode & S_IFMT)); if (inf[dir_arg].dir_p)