Subject: xsrc/13761: can't open a file
To: None <gnats-bugs@gnats.netbsd.org>
From: Hideo Saito <saito@densan.co.jp>
List: netbsd-bugs
Date: 08/20/2001 00:45:37
>Number:         13761
>Category:       xsrc
>Synopsis:       can't open a file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    xsrc-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 20 00:42:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Hideo Saito
>Release:        NetBSD 1.5.1
>Organization:
>Environment:
DCP-P750/10(DENSAN Compact-PCI bus PowerPC Board)
System: NetBSD vw5 1.5.1 NetBSD 1.5.1 (GENERIC) #4: Mon Jul 23 18:30:58 JST 2001 saito@vw4:/user5/NetBSD-1.5.1/usr/src/sys/arch/devosppc/compile/GENERIC devosppc

>Description:
When I ported xxgdb command and executed this command, 
could not display any source file at source window,
because function open() returned a value zero successfully.

>How-To-Repeat:
>Fix:
--- AsciiSrc.c.org	Tue Mar  6 06:14:45 2001
+++ AsciiSrc.c	Tue Jul 31 12:50:33 2001
@@ -1065,7 +1065,7 @@
     }
     
     if (!src->ascii_src.is_tempfile) {
-	if ((fd = open(src->ascii_src.string, open_mode, 0666))) {
+	if ((fd = open(src->ascii_src.string, open_mode, 0666)) >= 0) {
 	    if ((file = fdopen(fd, fdopen_mode)) != NULL) {
 		(void)fseek(file, 0, SEEK_END);
 		src->ascii_src.length = (XawTextPosition)ftell(file);
--- MultiSrc.c.org	Tue Mar  6 06:14:46 2001
+++ MultiSrc.c	Tue Jul 31 12:50:02 2001
@@ -1173,7 +1173,7 @@
     }
     
     if (!src->multi_src.is_tempfile) {
-	if ((fd = open(src->multi_src.string, open_mode, 0666))) {
+	if ((fd = open(src->multi_src.string, open_mode, 0666)) >= 0) {
 	    if ((file = fdopen(fd, fdopen_mode)) != NULL) {
 		(void)fseek(file, 0, SEEK_END);
 		src->multi_src.length = (XawTextPosition)ftell(file);
>Release-Note:
>Audit-Trail:
>Unformatted: