Source-Changes-D archive

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

Re: CVS commit: src



On Tue, Apr 12, 2011 at 07:39:54AM +0100, David Laight wrote:
> Wouldn't it be less confusing to have opened /etc/protocols before
> doing the chroot ??

Hmm, now that you mention it - a 

        setprotoent(1);

before the chroot should do, shouldn't it?

I don't know which solution is preferable, or how upstream would like it,
but this looks indeed simpler (haven't tested it though).

Martin
Index: tcpdump.c
===================================================================
RCS file: /cvsroot/src/external/bsd/tcpdump/dist/tcpdump.c,v
retrieving revision 1.2
diff -u -r1.2 tcpdump.c
--- tcpdump.c   5 Dec 2010 05:11:31 -0000       1.2
+++ tcpdump.c   12 Apr 2011 10:49:50 -0000
@@ -469,6 +469,9 @@
        pw = getpwnam(username);
        if (pw) {
                if (chroot_dir) {
+#ifndef WIN32
+                       setprotoent(1);
+#endif /* WIN32 */
                        if (chroot(chroot_dir) != 0 || chdir ("/") != 0) {
                                fprintf(stderr, "tcpdump: Couldn't chroot/chdir 
to '%.64s': %s\n",
                                    chroot_dir, pcap_strerror(errno));


Home | Main Index | Thread Index | Old Index