Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Oct 1996 14:50:22 -0800 (PST)
From:      Archie Cobbs <archie@whistle.com>
To:        current@freebsd.org
Subject:   Strange bug related to fstat()
Message-ID:  <199610272250.OAA14535@bubba.whistle.com>

next in thread | raw e-mail | index | archive | help

I'm trying to track down a bug that's completely baffling to me...
any help would be greatly appreciated. This is in a pretty -current
environment.

Within a little background daemon, the system() command is used
to execute a command looking something like this:

  system("tar cf - file1 file2 | gzip -cf | uuencode files > output");

What's happening is that gzip is failing, and the place it fails
is where it tries to fstat() standard input:

  if (fstat(fileno(stdin), &istat) != 0) {
      error("fstat(stdin)");
  }

The error it's getting is "Bad file descriptor".

Of course, if there's any way the daemon could be causing this
to happen I'm sure it is! But I can't figure out how it could.

Can this error possibly be correct, unless there is a bug in
gzip itself? Even if the "tar" command failed, standard input
should still exist until closed, no?

The only other possibilities seem to be a bug in /bin/sh or the
kernel.  As you can see, I need a little hint as to how to pursue
this one...

Thanks for any help.

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610272250.OAA14535>