summaryrefslogtreecommitdiff
path: root/lib/same.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-08-19 10:02:53 +0000
committerJim Meyering <jim@meyering.net>2003-08-19 10:02:53 +0000
commit7c4acc4f65f6cfba96c21fbee1669915595b8658 (patch)
treea4d1bebad9d7e5876ad44e1bd005ce695e471efd /lib/same.c
parentd7787443ec998313bc985429311da0b137ff83d3 (diff)
downloadcoreutils-7c4acc4f65f6cfba96c21fbee1669915595b8658.tar.xz
Include <stdlib.h> and <string.h> unconditionally,
as we're now assuming that part of hosted C89. (free) [!HAVE_DECL_FREE]: Remove decl; no longer needed. (same_name): Invoke pathconf on destination, not source, as that's a bit clearer even if they are the same dir.
Diffstat (limited to 'lib/same.c')
-rw-r--r--lib/same.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/lib/same.c b/lib/same.c
index c0b92447e..aa1a2318f 100644
--- a/lib/same.c
+++ b/lib/same.c
@@ -26,9 +26,7 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
@@ -37,11 +35,7 @@
extern int errno;
#endif
-#if HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
#include <limits.h>
#ifndef _POSIX_NAME_MAX
@@ -53,13 +47,6 @@ extern int errno;
#include "error.h"
#include "xalloc.h"
-#ifndef HAVE_DECL_FREE
-"this configure-time declaration test was not run"
-#endif
-#if !HAVE_DECL_FREE
-void free ();
-#endif
-
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SAME_INODE(Stat_buf_1, Stat_buf_2) \
@@ -121,13 +108,13 @@ same_name (const char *source, const char *dest)
#if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX
if (same && ! identical_basenames)
{
- long name_max = (errno = 0, pathconf (source_dirname, _PC_NAME_MAX));
+ long name_max = (errno = 0, pathconf (dest_dirname, _PC_NAME_MAX));
if (name_max < 0)
{
if (errno)
{
/* Shouldn't happen. */
- error (1, errno, "%s", source_dirname);
+ error (1, errno, "%s", dest_dirname);
}
same = false;
}