emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

read in movemail.c


From: Dan Nicolaescu
Subject: read in movemail.c
Date: Fri, 28 Apr 2006 09:25:32 -0700


CID: 29
Checker: NEGATIVE_RETURNS (help)
File: emacs/lib-src/movemail.c
Function: main
Description: Tracked variable "nread" was passed to a negative sink.


463           {
464             char buf[1024];
465     
466             while (1)
467               {

Event negative_return_fn: Called negative-returning function "read"
Event var_assign: NEGATIVE return value of "read" assigned to signed variable 
"nread"
Also see events: [var_assign][negative_returns]

468                 nread = read (indesc, buf, sizeof buf);

Event negative_returns: Tracked variable "nread" was passed to a negative sink.
Also see events: [negative_return_fn][var_assign]

469                 if (nread != write (outdesc, buf, nread))
470                   {
471                     int saved_errno = errno;
472                     unlink (outname);
473                     errno = saved_errno;
474                     pfatal_with_name (outname);
475                   }
476                 if (nread < sizeof buf)
477                   break;



Is it portable to just pass "nread" to write and compare the return
values? Maybe "nread" can be checked before?






reply via email to

[Prev in Thread] Current Thread [Next in Thread]