summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2015-01-19 19:46:56 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2015-01-19 19:46:56 +0000
commit94fb85a2a1f3269d5841c9165c087ce56a28bbb5 (patch)
treec78593d58f02cb49c388264aa5d5c6daa38f2af0 /gnu
parentbe39a653f1af98ce2f535d5f9dea93c1523e49c9 (diff)
Prefer strdup() to malloc() + strcpy() and ftello() to ftell()
ok deraadt@ guenther@ millert@
Diffstat (limited to 'gnu')
-rw-r--r--gnu/lib/libiberty/src/argv.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/gnu/lib/libiberty/src/argv.c b/gnu/lib/libiberty/src/argv.c
index 11ca549a8ea..9e853ff2632 100644
--- a/gnu/lib/libiberty/src/argv.c
+++ b/gnu/lib/libiberty/src/argv.c
@@ -79,14 +79,12 @@ dupargv (char **argv)
/* the strings */
for (argc = 0; argv[argc] != NULL; argc++)
{
- int len = strlen (argv[argc]);
- copy[argc] = (char *) malloc (len + 1);
+ copy[argc] = strdup (argv[argc]);
if (copy[argc] == NULL)
{
freeargv (copy);
return NULL;
}
- strcpy (copy[argc], argv[argc]);
}
copy[argc] = NULL;
return copy;
@@ -330,7 +328,7 @@ expandargv (argcp, argvp)
FILE *f;
/* An upper bound on the number of characters in the response
file. */
- long pos;
+ off_t pos;
/* The number of characters in the response file, when actually
read. */
size_t len;
@@ -352,7 +350,7 @@ expandargv (argcp, argvp)
continue;
if (fseek (f, 0L, SEEK_END) == -1)
goto error;
- pos = ftell (f);
+ pos = ftello (f);
if (pos == -1)
goto error;
if (fseek (f, 0L, SEEK_SET) == -1)