aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/src/libbsc/abis_nm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index 5a968492d..c29e21b3d 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -829,6 +829,11 @@ static int is_last_line(FILE *stream)
/* check if we're sending the last line */
pos = ftell(stream);
+
+ /* Did ftell fail? Then we are at the end for sure */
+ if (pos < 0)
+ return 1;
+
if (!fgets(next_seg_buf, sizeof(next_seg_buf)-2, stream)) {
fseek(stream, pos, SEEK_SET);
return 1;