From 6d893bd991df2d3d0b56be3a2cf926756c602915 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 1 Apr 2006 19:12:44 +0000 Subject: [PATCH] [BZ #2450] * posix/unistd.h: Match return value of readlink to what POSIX says these days. * io/readlink.c: Likewise. * io/readlinkat.c: Likewise. * sysdeps/unix/sysv/linux/readlinkat.c: Likewise. --- ChangeLog | 7 +++++++ io/readlink.c | 4 ++-- io/readlinkat.c | 4 ++-- posix/unistd.h | 9 +++++---- sysdeps/unix/sysv/linux/readlinkat.c | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0601dca..c2b9b14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2006-04-01 Ulrich Drepper + [BZ #2450] + * posix/unistd.h: Match return value of readlink to what POSIX + says these days. + * io/readlink.c: Likewise. + * io/readlinkat.c: Likewise. + * sysdeps/unix/sysv/linux/readlinkat.c: Likewise. + [BZ #2498] * nscd/connections.c (main_loop_poll): If the connection cannot be accepted because of user-imposed limits close the descriptor. diff --git a/io/readlink.c b/io/readlink.c index 779b809..b69d086 100644 --- a/io/readlink.c +++ b/io/readlink.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1996, 1997, 2006 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 @@ -22,7 +22,7 @@ /* Read the contents of the symbolic link PATH into no more than LEN bytes of BUF. The contents are not null-terminated. Returns the number of characters read, or -1 for errors. */ -int +ssize_t __readlink (path, buf, len) const char *path; char *buf; diff --git a/io/readlinkat.c b/io/readlinkat.c index c6a032c..483dc49 100644 --- a/io/readlinkat.c +++ b/io/readlinkat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2006 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 @@ -23,7 +23,7 @@ /* Read the contents of the symbolic link PATH relative to FD into no more than LEN bytes of BUF. The contents are not null-terminated. Returns the number of characters read, or -1 for errors. */ -int +ssize_t readlinkat (fd, path, buf, len) int fd; const char *path; diff --git a/posix/unistd.h b/posix/unistd.h index c8e8a05..c7a5272 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -770,8 +770,9 @@ extern int symlink (__const char *__from, __const char *__to) /* Read the contents of the symbolic link PATH into no more than LEN bytes of BUF. The contents are not null-terminated. Returns the number of characters read, or -1 for errors. */ -extern int readlink (__const char *__restrict __path, char *__restrict __buf, - size_t __len) __THROW __nonnull ((1, 2)) __wur; +extern ssize_t readlink (__const char *__restrict __path, + char *__restrict __buf, size_t __len) + __THROW __nonnull ((1, 2)) __wur; #endif /* Use BSD. */ #ifdef __USE_ATFILE @@ -780,8 +781,8 @@ extern int symlinkat (__const char *__from, int __tofd, __const char *__to) __THROW __nonnull ((1, 3)) __wur; /* Like readlink but a relative PATH is interpreted relative to FD. */ -extern int readlinkat (int __fd, __const char *__restrict __path, - char *__restrict __buf, size_t __len) +extern ssize_t readlinkat (int __fd, __const char *__restrict __path, + char *__restrict __buf, size_t __len) __THROW __nonnull ((2, 3)) __wur; #endif diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c index c2f21ee..9b4a730 100644 --- a/sysdeps/unix/sysv/linux/readlinkat.c +++ b/sysdeps/unix/sysv/linux/readlinkat.c @@ -29,7 +29,7 @@ /* Read the contents of the symbolic link PATH relative to FD into no more than LEN bytes of BUF. */ -int +ssize_t readlinkat (fd, path, buf, len) int fd; const char *path; -- 2.7.4