@@ -3,7 +3,7 @@ reader_network - A package of utilities to record and work with
33multicast radar data in ASTERIX format. (radar as in air navigation
44surveillance).
55
6- Copyright (C) 2002-2013 Diego Torres <diego dot torres at gmail dot com>
6+ Copyright (C) 2002-2019 Diego Torres <diego dot torres at gmail dot com>
77
88This file is part of the reader_network utils.
99
@@ -201,8 +201,10 @@ int main(int argc, char *argv[]) {
201201 if (current_date .tv_sec >= (old_date .tv_sec + LAP_TIME )) {
202202 close (fd_out );
203203 // compressing old memresp recording in background
204- sprintf (ptr_bzip , "/bin/sh -c '/bin/bzip2 %s' &" , ptr_filename );
205- system (ptr_bzip );
204+ sprintf (ptr_bzip , "/bin/sh -c '/bin/bzip2 %s' &" , ptr_filename );
205+ if ( (ret = system (ptr_bzip )) < 0 ) {
206+ printf ("error bzip2: %s\n" , ptr_bzip ); exit (EXIT_FAILURE );
207+ }
206208 t2 = gmtime (& current_date .tv_sec );
207209 sprintf (ptr_destdir , "%s/%02d/" , argv [1 ], t2 -> tm_mday );
208210 sprintf (ptr_mkdir , "/bin/mkdir -p %s" , ptr_destdir );
@@ -223,13 +225,16 @@ int main(int argc, char *argv[]) {
223225 socklen_t addrlen = sizeof (struct sockaddr_in );
224226 memset (& cast_group , 0 , sizeof (cast_group ));
225227 if ((udp_size = recvfrom (s_in , ptr_in , 65535 , 0 , (struct sockaddr * ) & cast_group , & addrlen )) < 0 ) {
226- printf ("error recvfrom:%s\n" , strerror (errno )); //exit(EXIT_FAILURE);
228+ printf ("error recvfrom: %s\n" , strerror (errno )); //exit(EXIT_FAILURE);
227229 close (s_in );
228230 subscribe ();
229231 }
230232 if (( udp_size > 0 ) && (!strcasecmp (inet_ntoa (cast_group .sin_addr ), "214.25.250.1" ))) {
231233 // write to file
232- write (fd_out , ptr_in , udp_size );
234+ ret = write (fd_out , ptr_in , udp_size );
235+ if ( ret < 0 ) {
236+ printf ("error write: %s\n" , strerror (errno )); exit (EXIT_FAILURE );
237+ }
233238 } else {
234239 // no sabemos de donde viene!
235240 }
@@ -246,9 +251,9 @@ int main(int argc, char *argv[]) {
246251// printf("salido\n");
247252
248253 ret = sendto (s_out , dump_stop , 12 , 0 , (struct sockaddr * )& addr1 , sizeof (addr1 ));
249- if (ret < 12 ) { printf ("error sendto(%d):%s\n" , ret , strerror (errno )); exit (EXIT_FAILURE ); }
254+ if (ret < 12 ) { printf ("error sendto(%d): %s\n" , ret , strerror (errno )); exit (EXIT_FAILURE ); }
250255 ret = sendto (s_out , dump_stop , 12 , 0 , (struct sockaddr * )& addr2 , sizeof (addr2 ));
251- if (ret < 12 ) { printf ("error sendto(%d):%s\n" , ret , strerror (errno )); exit (EXIT_FAILURE ); }
256+ if (ret < 12 ) { printf ("error sendto(%d): %s\n" , ret , strerror (errno )); exit (EXIT_FAILURE ); }
252257
253258 close (fd_out );
254259 close (s_in );
0 commit comments