Skip to content

Commit c8c481b

Browse files
committed
update travis.yml and add error codes to memresp.c
1 parent 88023e6 commit c8c481b

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ script:
1212
- ./build.sh
1313
- valgrind --leak-check=full --show-reachable=yes bin/reader_network64 bin/conf/066test_filter.conf
1414
- valgrind --leak-check=full --show-reachable=yes bin/reader_network64 bin/conf/068test_bds30.conf
15-
- valgrind --leak-check=full --show-reachable=yes bin/reader_rrd364 -s bin/datos/068test_rrd3.gps -3 -y -o -r centro
16-
- valgrind --leak-check=full --show-reachable=yes bin/reader_rrd364 -s bin/datos/068test_bds30.gps -3 -y -o -r centro
15+
- valgrind --leak-check=full --show-reachable=yes bin/reader_rrd364 -s bin/datos/068test_rrd3.gps --do-delays --do-bds30 --do-caps --stdout -r centro
16+
- valgrind --leak-check=full --show-reachable=yes bin/reader_rrd364 -s bin/datos/068test_bds30.gps --do-delays --do-bds30 --do-caps --stdout -r centro
1717
- valgrind --leak-check=full --show-reachable=yes bin/cleanast64 bin/datos/local.gps bin/datos/local.ast 2200 0 10
1818

1919
env:

src/memresp/memresp.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ reader_network - A package of utilities to record and work with
33
multicast radar data in ASTERIX format. (radar as in air navigation
44
surveillance).
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
88
This 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

Comments
 (0)