summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2009-12-28 10:16:54 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2009-12-28 10:23:56 +0100
commit5a2291e96a21474363ce9105800b3e3612ce0698 (patch)
treee67556a80bb196a89b6930a364c0bc14e2b28639
parent71bc11e757c49e67ca7c5fbc25ca89ba8a1a757e (diff)
[ipaccess] No need to use fdopen for the file (that was leaked too)
-rw-r--r--openbsc/src/abis_nm.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index 64c409388..9ed72530d 100644
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -1449,12 +1449,6 @@ static int sw_open_file(struct abis_nm_sw *sw, const char *fname)
rewind(sw->stream);
break;
case GSM_BTS_TYPE_NANOBTS:
- sw->stream = fdopen(sw->fd, "r");
- if (!sw->stream) {
- perror("fdopen");
- return -1;
- }
-
/* TODO: extract that from the filename or content */
rc = parse_sdp_header(sw);
if (rc < 0) {
@@ -1701,7 +1695,10 @@ int abis_nm_software_load_status(struct gsm_bts *bts)
return rc;
}
- percent = (ftell(sw->stream) * 100) / st.st_size;
+ if (sw->stream)
+ percent = (ftell(sw->stream) * 100) / st.st_size;
+ else
+ percent = (lseek(sw->fd, 0, SEEK_CUR) * 100) / st.st_size;
return percent;
}