X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fldso%2Fdynlink.c;h=ba2f61296d219332764b7dc36011bab2fe04c1a7;hb=65465101ee23447bf30adc3a9ebf817d58f5d956;hp=c295301f4105a8305caf53056990321dcbf26400;hpb=40d5f7eb8323bcc36344424023b82603fa04cb93;p=musl diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index c295301f..ba2f6129 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -478,8 +478,11 @@ static struct dso *load_library(const char *name) if (!sys_path) { FILE *f = fopen(ETC_LDSO_PATH, "rbe"); if (f) { - if (getline(&sys_path, (size_t[1]){0}, f) > 0) - sys_path[strlen(sys_path)-1]=0; + if (getline(&sys_path, (size_t[1]){0}, f) > 0) { + size_t l = strlen(sys_path); + if (l && sys_path[l-1]=='\n') + sys_path[-1] = 0; + } fclose(f); } }