public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Thorsten Kukuk <kukuk@suse.de>
To: libc-hacker@sources.redhat.com
Subject: __atfct_seterrno() or futimesat() broken
Date: Sat, 28 Jan 2006 16:55:00 -0000	[thread overview]
Message-ID: <20060128165511.GA4000@suse.de> (raw)


Hi,

if you call futimesat() without kernel syscall support and without
/proc mounted you will get a seg.fault in __atfct_seterrno():

(gdb) down
#0  0x400d8f53 in __atfct_seterrno (errval=2, fd=0,
    buf=0xbfffe4e0 "/proc/self/fd/0") at openat.c:61
61                *(char *) strchr (buf + sizeof "/proc/self/fd", '/') = '\0';


The problem is that all *at.c files uses:
static const char procfd[] = "/proc/self/fd/%d/%s";

except futimesat.c, which does not append the filename after the
file descriptor (as you can see from gdb output).
So the strchr will not find a "/" and the return value is NULL.

First question is: Should futimesat.c append the filename, too, or
should it not call __atfct_seterrno?

Second question about __atfct_seterrno: This function only checks for
ENOTDIR if /proc is mounted. Why? utime() in futimesat.c returns
ENOENT for this case:

utimes("/proc/self/fd/0", NULL)         = -1 ENOENT (No such file or directory)

Shouldn't the check, if /proc is mounted, be the first on in 
__atfct_seterrno?

  Thorsten

-- 
Thorsten Kukuk         http://www.suse.de/~kukuk/      kukuk@suse.de
SUSE LINUX Products GmbH       Maxfeldstr. 5       D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B

             reply	other threads:[~2006-01-28 16:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-28 16:55 Thorsten Kukuk [this message]
2006-02-02 10:15 ` Roland McGrath

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=20060128165511.GA4000@suse.de \
    --to=kukuk@suse.de \
    --cc=libc-hacker@sources.redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).