summaryrefslogtreecommitdiffstats
path: root/term-utils/write.c
diff options
context:
space:
mode:
authorKarel Zak2011-09-06 03:18:46 +0200
committerKarel Zak2011-09-06 03:18:46 +0200
commitb89fdd9c05a6e5f12ab56441389e5ee9d1d7f30f (patch)
tree711ada422560fa21f5da231c12851296519f8bca /term-utils/write.c
parentdmesg: remove extra space only after time stamp (diff)
downloadkernel-qcow2-util-linux-b89fdd9c05a6e5f12ab56441389e5ee9d1d7f30f.tar.gz
kernel-qcow2-util-linux-b89fdd9c05a6e5f12ab56441389e5ee9d1d7f30f.tar.xz
kernel-qcow2-util-linux-b89fdd9c05a6e5f12ab56441389e5ee9d1d7f30f.zip
write: fix path for freopen()
Reported-by: xinglp <xinglp@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'term-utils/write.c')
-rw-r--r--term-utils/write.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/term-utils/write.c b/term-utils/write.c
index a825f6247..a70eb7bd1 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);