From 66dde65f2ea92e2c0df41d74bcfe0323a73d9001 Mon Sep 17 00:00:00 2001 From: Rohit Gupta <rohit.gupta@eurecom.fr> Date: Tue, 5 Apr 2016 21:44:41 +0200 Subject: [PATCH] added a new check for illegal file permissions to mbmssim.c, to avoid a segfault if permissions are invalid. --- openair1/SIMULATION/LTE_PHY/mbmssim.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c index e2fa439be5..0e14619cda 100644 --- a/openair1/SIMULATION/LTE_PHY/mbmssim.c +++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c @@ -337,7 +337,11 @@ int main(int argc, char **argv) else sprintf(fname,"embms_awgn_%d_%d.m",mcs,N_RB_DL); - fd = fopen(fname,"w"); + if (!(fd = fopen(fname,"w"))) { + printf("Cannot open %s, check permissions\n",fname); + exit(-1); + } + if (awgn_flag==0) fprintf(fd,"SNR_%d_%d=[];errs_mch_%d_%d=[];mch_trials_%d_%d=[];\n", -- GitLab