projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix possible bug when no args have been provided to the executable
[deliverable/binutils-gdb.git]
/
libiberty
/
getpwd.c
diff --git
a/libiberty/getpwd.c
b/libiberty/getpwd.c
index c5408794a2764983612d889da11dc65593d51041..fa5c132fd6b6e48c11efe723dfc492635ddc1522 100644
(file)
--- a/
libiberty/getpwd.c
+++ b/
libiberty/getpwd.c
@@
-2,7
+2,7
@@
/*
/*
-@deftypefn Supplemental char* getpwd ()
+@deftypefn Supplemental char* getpwd (
void
)
Returns the current working directory. This implementation caches the
result on the assumption that the process will not call @code{chdir}
Returns the current working directory. This implementation caches the
result on the assumption that the process will not call @code{chdir}
@@
-35,10
+35,9
@@
extern int errno;
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
-
-/* Prototype these in case the system headers don't provide them. */
-extern char *getpwd ();
-extern char *getwd ();
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
#include "libiberty.h"
#include "libiberty.h"
@@
-47,6
+46,8
@@
extern char *getwd ();
the few exceptions to the general rule here. */
#if !defined(HAVE_GETCWD) && defined(HAVE_GETWD)
the few exceptions to the general rule here. */
#if !defined(HAVE_GETCWD) && defined(HAVE_GETWD)
+/* Prototype in case the system headers doesn't provide it. */
+extern char *getwd ();
#define getcwd(buf,len) getwd(buf)
#endif
#define getcwd(buf,len) getwd(buf)
#endif
@@
-64,7
+65,7
@@
extern char *getwd ();
yield 0 and set errno. */
char *
yield 0 and set errno. */
char *
-getpwd ()
+getpwd (
void
)
{
static char *pwd;
static int failure_errno;
{
static char *pwd;
static int failure_errno;
@@
-83,7
+84,7
@@
getpwd ()
&& dotstat.st_dev == pwdstat.st_dev))
/* The shortcut didn't work. Try the slow, ``sure'' way. */
&& dotstat.st_dev == pwdstat.st_dev))
/* The shortcut didn't work. Try the slow, ``sure'' way. */
- for (s = GUESSPATHLEN; !
getcwd (p = xmalloc (
s), s); s *= 2)
+ for (s = GUESSPATHLEN; !
getcwd (p = XNEWVEC (char,
s), s); s *= 2)
{
int e = errno;
free (p);
{
int e = errno;
free (p);
@@
-111,12
+112,12
@@
getpwd ()
#endif
char *
#endif
char *
-getpwd ()
+getpwd (
void
)
{
static char *pwd = 0;
if (!pwd)
{
static char *pwd = 0;
if (!pwd)
- pwd = getcwd (
xmalloc (
MAXPATHLEN + 1), MAXPATHLEN + 1
+ pwd = getcwd (
XNEWVEC (char,
MAXPATHLEN + 1), MAXPATHLEN + 1
#ifdef VMS
, 0
#endif
#ifdef VMS
, 0
#endif
This page took
0.02352 seconds
and
4
git commands to generate.