[sr-dev] git:master:f152fc45: carrierroute: check return value for fseek

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 1 10:36:10 CEST 2017


Module: kamailio
Branch: master
Commit: f152fc4586b42fb8a26b01d0c40e41e143972b9a
URL: https://github.com/kamailio/kamailio/commit/f152fc4586b42fb8a26b01d0c40e41e143972b9a

Author: Claudiu Boriga <paul.boriga at 1and1.ro>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-08-01T10:36:01+02:00

carrierroute: check return value for fseek

---

Modified: src/modules/carrierroute/parser_carrierroute.c

---

Diff:  https://github.com/kamailio/kamailio/commit/f152fc4586b42fb8a26b01d0c40e41e143972b9a.diff
Patch: https://github.com/kamailio/kamailio/commit/f152fc4586b42fb8a26b01d0c40e41e143972b9a.patch

---

diff --git a/src/modules/carrierroute/parser_carrierroute.c b/src/modules/carrierroute/parser_carrierroute.c
index 535e1f9f19..c6fbf933f9 100644
--- a/src/modules/carrierroute/parser_carrierroute.c
+++ b/src/modules/carrierroute/parser_carrierroute.c
@@ -236,7 +236,10 @@ int parse_options(FILE* file, option_description* opts, int no_options, char* en
 		/* parsing stops when end_str is reached: e.g: }, target */
 		if ( strncmp(data.s, end_str, strlen(end_str)) == 0){
 			LM_DBG("End of options list received \n");
-			fseek(file, -full_line_len, SEEK_CUR);
+			if (fseek(file, -full_line_len, SEEK_CUR) != 0){
+				LM_ERR("fseek failed: %s",strerror(errno));
+				break;
+			}
 			ret = SUCCESSFUL_PARSING;
 			break;
 		}
@@ -385,9 +388,11 @@ int parse_struct_header(FILE* file, char* expected_struct_type, str* struct_name
 		memcpy(struct_name->s, name, struct_name->len);
 		struct_name->s[struct_name->len]='\0';
 	}
-	else
-		fseek(file, -full_line_len, SEEK_CUR);
-
+	else{
+		if (fseek(file, -full_line_len, SEEK_CUR) != 0){
+			LM_ERR("fseek failed: %s",strerror(errno));
+		}
+	}
 	return ret;
 }
 




More information about the sr-dev mailing list