@@ -488,6 +488,7 @@ void init_menu_system_values(){
488488 volume_percentage = 50 ; ///wrong value: setting default to 50
489489 }
490490 else {
491+ pclose (fp );
491492 fgets (res , sizeof (res )- 1 , fp );
492493
493494 /// Check if Volume is a number (at least the first char)
@@ -508,6 +509,7 @@ void init_menu_system_values(){
508509 brightness_percentage = 50 ; ///wrong value: setting default to 50
509510 }
510511 else {
512+ pclose (fp );
511513 fgets (res , sizeof (res )- 1 , fp );
512514
513515 /// Check if brightness is a number (at least the first char)
@@ -767,7 +769,10 @@ void run_menu_loop()
767769 RES_HW_SCREEN_HORIZONTAL * RES_HW_SCREEN_VERTICAL * sizeof (u16 ));
768770
769771 /* Stop Ampli */
770- popen (SHELL_CMD_TURN_AMPLI_OFF , "r" );
772+ fp = popen (SHELL_CMD_TURN_AMPLI_OFF , "r" );
773+ if (fp != NULL ) {
774+ pclose (fp );
775+ }
771776
772777 /// ------ Wait for menu UP key event ------
773778 while (event .type != SDL_KEYUP || event .key .keysym .sym != SDLK_q ){
@@ -860,6 +865,8 @@ void run_menu_loop()
860865 fp = popen (shell_cmd , "r" );
861866 if (fp == NULL ) {
862867 MENU_ERROR_PRINTF ("Failed to run command %s\n" , shell_cmd );
868+ } else {
869+ pclose (fp );
863870 }
864871
865872 /// ------ Refresh screen ------
@@ -876,6 +883,8 @@ void run_menu_loop()
876883 fp = popen (shell_cmd , "r" );
877884 if (fp == NULL ) {
878885 MENU_ERROR_PRINTF ("Failed to run command %s\n" , shell_cmd );
886+ } else {
887+ pclose (fp );
879888 }
880889 /// ------ Refresh screen ------
881890 screen_refresh = 1 ;
@@ -932,6 +941,8 @@ void run_menu_loop()
932941 fp = popen (shell_cmd , "r" );
933942 if (fp == NULL ) {
934943 MENU_ERROR_PRINTF ("Failed to run command %s\n" , shell_cmd );
944+ } else {
945+ pclose (fp );
935946 }
936947 /// ------ Refresh screen ------
937948 screen_refresh = 1 ;
@@ -947,6 +958,8 @@ void run_menu_loop()
947958 fp = popen (shell_cmd , "r" );
948959 if (fp == NULL ) {
949960 MENU_ERROR_PRINTF ("Failed to run command %s\n" , shell_cmd );
961+ } else {
962+ pclose (fp );
950963 }
951964 /// ------ Refresh screen ------
952965 screen_refresh = 1 ;
@@ -1013,6 +1026,8 @@ void run_menu_loop()
10131026 fp = popen (shell_cmd , "r" );
10141027 if (fp == NULL ) {
10151028 MENU_ERROR_PRINTF ("Failed to run command %s\n" , shell_cmd );
1029+ } else {
1030+ pclose (fp );
10161031 }
10171032
10181033 stop_menu_loop = 1 ;
@@ -1058,6 +1073,8 @@ void run_menu_loop()
10581073 fp = popen (shell_cmd , "r" );
10591074 if (fp == NULL ) {
10601075 MENU_ERROR_PRINTF ("Failed to run command %s\n" , shell_cmd );
1076+ } else {
1077+ pclose (fp );
10611078 }
10621079
10631080 stop_menu_loop = 1 ;
@@ -1161,7 +1178,10 @@ void run_menu_loop()
11611178 }
11621179
11631180 /* Start Ampli */
1164- popen (SHELL_CMD_TURN_AMPLI_ON , "r" );
1181+ fp = popen (SHELL_CMD_TURN_AMPLI_ON , "r" );
1182+ if (fp != NULL ) {
1183+ pclose (fp );
1184+ }
11651185
11661186 /// ------ Reset last screen ------
11671187 if (reset_last_scren_on_exit ){
@@ -1191,9 +1211,13 @@ int launch_resume_menu_loop()
11911211 uint8_t screen_refresh = 1 ;
11921212 uint8_t menu_confirmation = 0 ;
11931213 int option_idx = RESUME_YES ;
1214+ FILE * fp ;
11941215
11951216 /* Stop Ampli */
1196- popen (SHELL_CMD_TURN_AMPLI_OFF , "r" );
1217+ fp = popen (SHELL_CMD_TURN_AMPLI_OFF , "r" );
1218+ if (fp != NULL ) {
1219+ pclose (fp );
1220+ }
11971221
11981222 /* Save prev key repeat params and set new Key repeat */
11991223 SDL_GetKeyRepeat (& backup_key_repeat_delay , & backup_key_repeat_interval );
@@ -1361,7 +1385,10 @@ int launch_resume_menu_loop()
13611385 }
13621386
13631387 /* Start Ampli */
1364- popen (SHELL_CMD_TURN_AMPLI_ON , "r" );
1388+ fp = popen (SHELL_CMD_TURN_AMPLI_ON , "r" );
1389+ if (fp != NULL ) {
1390+ pclose (fp );
1391+ }
13651392
13661393 return option_idx ;
13671394}
@@ -3193,6 +3220,8 @@ static void menu_bios_warn(void)
31933220 FILE * fp = popen (shell_cmd , "r" );
31943221 if (fp == NULL ) {
31953222 printf ("In %s, Failed to run command %s\n" , __func__ , shell_cmd );
3223+ } else {
3224+ pclose (fp );
31963225 }
31973226
31983227 /// ------ Wait for key press ------
@@ -3206,6 +3235,8 @@ static void menu_bios_warn(void)
32063235 fp = popen (SHELL_CMD_NOTIF_CLEAR , "r" );
32073236 if (fp == NULL ) {
32083237 printf ("In %s, Failed to run command %s\n" , __func__ , SHELL_CMD_NOTIF_CLEAR );
3238+ } else {
3239+ pclose (fp );
32093240 }
32103241}
32113242
0 commit comments