From: Wayne Davison <wayned@users.sourceforge.net>
To: zsh-workers@sunsite.dk
Subject: 2 valgrind warnings and their fixes
Date: Sun, 17 Oct 2004 13:42:21 -0700 [thread overview]
Message-ID: <20041017204221.GB26158@blorf.net> (raw)
In zleread() (in Zle/zle_main.c), I just added a line that sets the
first byte of the newly malloced "line" buffer to '\0'. Without this,
typing a space as the first character on the line generates a warning
about magicspace()'s call of strchr() accessing uninitialized memory
(if space is bound to magic-space, of course).
Another warning that occurs quite a bit is this one:
Warning: invalid file descriptor -1 in syscall close()
Sure, that's not very worrisome, but it is easy to get rid of with a
simple change to zclose() that ensures that close() will only get called
when fd >= 0:
--- Src/utils.c 5 Oct 2004 10:39:43 -0000 1.66
+++ Src/utils.c 17 Oct 2004 20:35:51 -0000
@@ -1117,8 +1117,9 @@ zclose(int fd)
coprocin = -1;
if (fd == coprocout)
coprocout = -1;
+ return close(fd);
}
- return close(fd);
+ return -1;
}
/* Get a file name relative to $TMPPREFIX which *
Any reason why we wouldn't want to make this change? I don't see anyone
that is expecting errno to be set in such a case (nor anyone who even
checks the return value of zclose()).
..wayne..
next reply other threads:[~2004-10-17 20:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-17 20:42 Wayne Davison [this message]
2004-10-18 0:39 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041017204221.GB26158@blorf.net \
--to=wayned@users.sourceforge.net \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).