* Problem report #7
@ 2006-04-11 15:49 Dan Nicolaescu
2006-04-11 17:09 ` Stuart D. Herring
2006-04-11 17:22 ` Andreas Schwab
0 siblings, 2 replies; 3+ messages in thread
From: Dan Nicolaescu @ 2006-04-11 15:49 UTC (permalink / raw)
CID: 7
Checker: DEADCODE (help)
File: emacs/src/fileio.c
Function: Finsert_file_contents
Description: After this line, the value of "fd" is equal to -1
Event assignment: Assigning "-1" to "fd"
Event const: After this line, the value of "fd" is equal to -1
Also see events: [dead_error_line][dead_error_condition][const]
3799 fd = -1;
3800
3801 #ifdef WINDOWSNT
3802 {
3803 Lisp_Object tem = Vw32_get_true_file_attributes;
3804
3805 /* Tell stat to use expensive method to get accurate info. */
3806 Vw32_get_true_file_attributes = Qt;
3807 total = stat (SDATA (filename), &st);
3808 Vw32_get_true_file_attributes = tem;
3809 }
3810 if (total < 0)
3811 #else
3812 #ifndef APOLLO
3813 if (stat (SDATA (filename), &st) < 0)
3814 #else
3815 if ((fd = emacs_open (SDATA (filename), O_RDONLY, 0)) < 0
3816 || fstat (fd, &st) < 0)
3817 #endif /* not APOLLO */
3818 #endif /* WINDOWSNT */
3819 {
Event dead_error_line: Cannot reach this line of code
Event dead_error_condition: On this path, the condition "fd >= 0" could not be true
Also see events: [dead_error_condition][assignment][const]
3820 if (fd >= 0) emacs_close (fd);
3821 badopen:
3822 if (NILP (visit))
3823 report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
3824 st.st_mtime = -1;
3825 how_much = 0;
3826 if (!NILP (Vcoding_system_for_read))
3827 Fset (Qbuffer_file_coding_system, Vcoding_system_for_read);
3828 goto notfound;
3829 }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problem report #7
2006-04-11 15:49 Problem report #7 Dan Nicolaescu
@ 2006-04-11 17:09 ` Stuart D. Herring
2006-04-11 17:22 ` Andreas Schwab
1 sibling, 0 replies; 3+ messages in thread
From: Stuart D. Herring @ 2006-04-11 17:09 UTC (permalink / raw)
> 3815 if ((fd = emacs_open (SDATA (filename), O_RDONLY, 0)) < 0
> 3816 || fstat (fd, &st) < 0)
> 3817 #endif /* not APOLLO */
> 3818 #endif /* WINDOWSNT */
This code can certainly assign interesting values to fd.
> 3819 {
>
> Event dead_error_line: Cannot reach this line of code
> Event dead_error_condition: On this path, the condition "fd >= 0" could
> not be true
> Also see events: [dead_error_condition][assignment][const]
>
> 3820 if (fd >= 0) emacs_close (fd);
So this test isn't useless. But maybe this line should be moved to just
under the emacs_open() call, since it's only useful there? This fails to
imply any dangerous bug, in any event.
Davis
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problem report #7
2006-04-11 15:49 Problem report #7 Dan Nicolaescu
2006-04-11 17:09 ` Stuart D. Herring
@ 2006-04-11 17:22 ` Andreas Schwab
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2006-04-11 17:22 UTC (permalink / raw)
Dan Nicolaescu <dann@ics.uci.edu> writes:
> 3812 #ifndef APOLLO
> 3813 if (stat (SDATA (filename), &st) < 0)
> 3814 #else
> 3815 if ((fd = emacs_open (SDATA (filename), O_RDONLY, 0)) < 0
> 3816 || fstat (fd, &st) < 0)
> 3817 #endif /* not APOLLO */
> 3818 #endif /* WINDOWSNT */
> 3819 {
>
> Event dead_error_line: Cannot reach this line of code
> Event dead_error_condition: On this path, the condition "fd >= 0" could not be true
Unless APOLLO is defined.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-04-11 17:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-11 15:49 Problem report #7 Dan Nicolaescu
2006-04-11 17:09 ` Stuart D. Herring
2006-04-11 17:22 ` Andreas Schwab
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).