From: Karel Zak <kzak@redhat.com>
To: xinglp <xinglp@gmail.com>
Cc: util-linux@vger.kernel.org,
LFS Developers Mailinglist <lfs-dev@linuxfromscratch.org>
Subject: Re: The "write" of util-linux-2.20 not work.
Date: Tue, 6 Sep 2011 03:21:49 +0200 [thread overview]
Message-ID: <20110906012149.GE4117@nb.redhat.com> (raw)
In-Reply-To: <CAHQM782=kH3G9=H91ONnc1EmX6-eU0fWAAGMh8+cfjvpZ+uQbA@mail.gmail.com>
On Tue, Sep 06, 2011 at 08:59:01AM +0800, xinglp wrote:
> it just prints
> write: : No such file or directory
>
> util-linux-2.19.1 works well
Hmm.. I found this stupid change:
- (void)sprintf(path, "/dev/%s", tty);
+ printf(path, "/dev/%s", tty);
in the commit 5f51b8b25de1c6c688d5172ed04008a94b241e05. Fixed below.
Karel
>From b89fdd9c05a6e5f12ab56441389e5ee9d1d7f30f Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 6 Sep 2011 03:18:46 +0200
Subject: [PATCH] write: fix path for freopen()
Reported-by: xinglp <xinglp@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
---
term-utils/write.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/term-utils/write.c b/term-utils/write.c
index a825f62..a70eb7b 100644
--- a/term-utils/write.c
+++ b/term-utils/write.c
@@ -322,7 +322,7 @@ void do_write(char *tty, char *mytty, uid_t myuid)
if (strlen(tty) + 6 > sizeof(path))
errx(EXIT_FAILURE, _("tty path %s too long"), tty);
- printf(path, "/dev/%s", tty);
+ snprintf(path, sizeof(path), "/dev/%s", tty);
if ((freopen(path, "w", stdout)) == NULL)
err(EXIT_FAILURE, "%s", path);
--
1.7.6
prev parent reply other threads:[~2011-09-06 1:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-06 0:59 The "write" of util-linux-2.20 not work xinglp
2011-09-06 1:21 ` Karel Zak [this message]
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=20110906012149.GE4117@nb.redhat.com \
--to=kzak@redhat.com \
--cc=lfs-dev@linuxfromscratch.org \
--cc=util-linux@vger.kernel.org \
--cc=xinglp@gmail.com \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.