From: Torsten Foertsch <torsten.foertsch@gmx.net>
To: Steven Micallef <steven.micallef@world.net>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>
Subject: Re: chroot() breaks syslog() ?
Date: Mon, 4 Aug 2003 09:23:47 +0200 [thread overview]
Message-ID: <200308040923.51241.torsten.foertsch@gmx.net> (raw)
In-Reply-To: <6416776FCC55D511BC4E0090274EFEF5080024A9@exchange.world.net>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 04 August 2003 07:27, Steven Micallef wrote:
> Hi all,
>
> I've stumbled onto what seems to have broken somewhere between 2.4.8 and
> 2.4.18 (sorry, I've been unable to test it on a later version just yet).
> Basically, when using chroot(), syslog() calls don't work.
>
> The following simple example is broken on 2.4.18:
>
> #include <stdio.h>
> #include <sys/syslog.h>
>
> int main(void) {
> chroot("/home/steve");
> syslog(LOG_ALERT, "TEST");
> }
consider syslogd's -a option. Or simply call openlog(3) with LOG_NDELAY before
chroot(). Or place the first call to syslog() before chroot(). Syscall() does
not close the socket between calls.
int main(void) {
openlog( "klaus", LOG_NDELAY, LOG_NEWS);
chroot("/tmp");
printf( "before\n" ); fflush( stdout );
syslog(LOG_ALERT, "TEST1");
printf( "between\n" ); fflush( stdout );
syslog(LOG_ALERT, "TEST2");
}
strace give the following output:
...
socket(PF_UNIX, SOCK_DGRAM, 0) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
connect(3, {sin_family=AF_UNIX, path="/dev/log"}, 16) = 0
chroot("/tmp") = 0
...
write(1, "before\n", 7before
) = 7
...
send(3, "<57>Aug 4 07:17:09 klaus: TEST1", 32, 0) = 32
rt_sigaction(SIGPIPE, {SIG_DFL}, NULL, 8) = 0
write(1, "between\n", 8between
) = 8
...
send(3, "<57>Aug 4 07:17:09 klaus: TEST2", 32, 0) = 32
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE/LgoGwicyCTir8T4RAqbzAJ9SPwFSnLyinG0C+ya/uTJRR4vwGQCeLxiV
ilmX6A7oJjou6ympLhFsDC4=
=mfSg
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2003-08-04 7:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-04 5:27 Steven Micallef
2003-08-04 5:19 ` Ben Collins
2003-08-04 7:23 ` Torsten Foertsch [this message]
2003-08-04 5:49 Steven Micallef
2003-08-04 5:34 ` Ben Collins
2003-08-04 6:12 ` David Lang
2003-08-04 8:40 ` Wichert Akkerman
2003-08-04 13:33 ` Herbert Pötzl
2003-08-04 20:19 ` Olaf Titz
2003-08-04 7:30 Steven Micallef
2003-08-06 8:42 Oliver Pitzeier
2003-08-06 11:08 ` Herbert Pötzl
2003-08-06 13:34 Oliver Pitzeier
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=200308040923.51241.torsten.foertsch@gmx.net \
--to=torsten.foertsch@gmx.net \
--cc=linux-kernel@vger.kernel.org \
--cc=steven.micallef@world.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®