summaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-02-17 05:47:01 +0000
committerUlrich Drepper <drepper@redhat.com>2004-02-17 05:47:01 +0000
commit33d5279258825463ffd51d7b810340bb56f11083 (patch)
tree557fca76905ae162f0482d781413661d3121aeda /stdlib
parentf40473668438eaba88eced8d4e78db1225e90542 (diff)
downloadglibc-33d5279258825463ffd51d7b810340bb56f11083.tar.gz
Update.
* stdlib/canonicalize.c (__realpath): Remove unnecessary copy operations.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/canonicalize.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
index 5c55c5dbd1..0947c67dd2 100644
--- a/stdlib/canonicalize.c
+++ b/stdlib/canonicalize.c
@@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1996-2001, 2002, 2004 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
@@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -204,12 +205,12 @@ __realpath (const char *name, char *resolved)
--dest;
*dest = '\0';
- return resolved ? memcpy (resolved, rpath, dest - rpath + 1) : rpath;
+ assert (resolved == NULL || resolved == rpath);
+ return resolved ?: rpath;
error:
- if (resolved)
- strcpy (resolved, rpath);
- else
+ assert (resolved == NULL || resolved == rpath);
+ if (resolved == NULL)
free (rpath);
return NULL;
}