summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-05-20 03:35:27 -0400
committermidipix <writeonce@midipix.org>2016-05-20 03:35:27 -0400
commitec61519fcbe346bfada5ce8d652453c6bc5981a9 (patch)
treed2fec76b667fbe9bd2d4ec1add2470cb369e78af /src
parent78abd7c518c43918f15e16b70af45c721d49bcd1 (diff)
downloadslibtool-ec61519fcbe346bfada5ce8d652453c6bc5981a9.tar.bz2
slibtool-ec61519fcbe346bfada5ce8d652453c6bc5981a9.tar.xz
slbt_exec_link_adjust_argument_vector(): switch from fscanf to fgets.
Diffstat (limited to 'src')
-rw-r--r--src/logic/slbt_exec_link.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index d279997..1273972 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -243,6 +243,7 @@ static int slbt_exec_link_adjust_argument_vector(
char * mark;
char * darg;
char * dot;
+ char * dep;
FILE * fdeps;
char * dpath;
bool freqd;
@@ -369,13 +370,20 @@ static int slbt_exec_link_adjust_argument_vector(
}
if (dpath) {
- *aarg = darg;
+ if (!stat(dpath,&st) && (fdeps = fopen(dpath,"r"))) {
+ dep = fgets(darg,st.st_size+1,fdeps);
+ *aarg = darg;
- if ((fdeps = fopen(dpath,"r"))) {
- while (fscanf(fdeps,"%s\n",darg) == 1) {
+ for (; dep; ) {
*aarg++ = darg;
- darg += strlen(darg);
- darg++;
+ darg += strlen(dep);
+
+ if (*--darg == '\n')
+ *darg = 0;
+ else
+ darg++;
+
+ dep = fgets(darg,st.st_size+1,fdeps);
}
if (ferror(fdeps)) {