aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/renameat.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-10-29 21:33:26 -0700
committerUlrich Drepper <drepper@redhat.com>2009-10-29 21:33:26 -0700
commit801720e63b20e3b8215764ff0d68a29534ca7e62 (patch)
treeb855ff7b284eadc784013c078f54978464687243 /sysdeps/unix/sysv/linux/renameat.c
parent584715c3a9b0030729e0a8504c820b3bd8d9353d (diff)
downloadglibc-801720e63b20e3b8215764ff0d68a29534ca7e62.tar
glibc-801720e63b20e3b8215764ff0d68a29534ca7e62.tar.gz
glibc-801720e63b20e3b8215764ff0d68a29534ca7e62.tar.bz2
glibc-801720e63b20e3b8215764ff0d68a29534ca7e62.zip
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.
Diffstat (limited to 'sysdeps/unix/sysv/linux/renameat.c')
-rw-r--r--sysdeps/unix/sysv/linux/renameat.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c
index 86bb75a7b0..160bdc4903 100644
--- a/sysdeps/unix/sysv/linux/renameat.c
+++ b/sysdeps/unix/sysv/linux/renameat.c
@@ -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