1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

Fix compat handling in *at functions.

When passed an empty string for the filename, the compat code
using /proc in all *at functions did the wrong thing.
This commit is contained in:
Ulrich Drepper
2009-10-29 21:33:26 -07:00
parent 584715c3a9
commit 801720e63b
19 changed files with 153 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
/* Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -135,6 +135,12 @@ renameat (oldfd, old, newfd, new)
if (oldfd != AT_FDCWD && old[0] != '/')
{
size_t filelen = strlen (old);
if (__builtin_expect (filelen == 0, 0))
{
__set_errno (ENOENT);
return -1;
}
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
- the file descriptor number
@ -154,6 +160,12 @@ renameat (oldfd, old, newfd, new)
if (newfd != AT_FDCWD && new[0] != '/')
{
size_t filelen = strlen (new);
if (__builtin_expect (filelen == 0, 0))
{
__set_errno (ENOENT);
return -1;
}
/* Buffer for the path name we are going to use. It consists of
- the string /proc/self/fd/
- the file descriptor number