Re: [PATCH] /test/*
Vincent CHAVANIS <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Thanks, I Will try soon to provide a patch in order to fix all segfaults of all /test/ applications I Will also use in the future the panic() function for args checks. Vincent. Alexander Malysh a écrit : > commited to cvs, thanks! > > Am 06.02.2009 um 14:45 schrieb Vincent CHAVANIS: > >> >> This patch fixes segfaults. >> >> -- Telemaque - 06560 SOPHIA-ANTIPOLIS - (FR) >> Service Technique/Reseau - NOC >> Direction du Developpement xMS+ >> http://www.telemaque.fr/ >> [email protected] >> Tel : +33 4 92 90 99 84 (fax 9142) >> diff -rauw /gateway-cvs/test/test_hmac.c /gateway/test/test_hmac.c >> --- /gateway-cvs/test/test_hmac.c 2009-01-14 10:24:21.000000000 +0100 >> +++ /gateway/test/test_hmac.c 2009-02-06 14:35:41.000000000 +0100 >> @@ -95,10 +95,18 @@ >> >> get_and_set_debugs(argc, argv, NULL); >> >> + if (argc < 3) { >> + printf("Syntax: %s <file>\n", argv[0]); >> + return -1; >> + } >> + >> key = octstr_create(argv[1]); >> filename = octstr_create(argv[2]); >> data = octstr_read_file(octstr_get_cstr(filename)); >> >> + if (data == NULL) >> + panic(0, "Cannot read file."); >> + >> debug("",0,"Dumping file `%s':", octstr_get_cstr(filename)); >> octstr_dump(data, 0); >> >> diff -rauw /gateway-cvs/test/test_md5.c /gateway/test/test_md5.c >> --- /gateway-cvs/test/test_md5.c 2009-01-14 10:24:21.000000000 +0100 >> +++ /gateway/test/test_md5.c 2009-02-06 14:38:29.000000000 +0100 >> @@ -74,6 +74,11 @@ >> >> get_and_set_debugs(argc, argv, NULL); >> >> + if (argc < 2) { >> + printf("Syntax: %s <txt>\n", argv[0]); >> + return -1; >> + } >> + >> data = octstr_create(argv[1]); >> enc = md5(data); >> >> diff -rauw /gateway-cvs/test/test_octstr_dump.c >> /gateway/test/test_octstr_dump.c >> --- /gateway-cvs/test/test_octstr_dump.c 2009-01-14 10:24:21.000000000 >> +0100 >> +++ /gateway/test/test_octstr_dump.c 2009-02-06 14:32:29.000000000 >> +0100 >> @@ -74,9 +74,17 @@ >> >> get_and_set_debugs(argc, argv, NULL); >> >> + if (argc < 2) { >> + printf("Syntax: %s <file>\n", argv[0]); >> + return -1; >> + } >> + >> filename = octstr_create(argv[1]); >> data = octstr_read_file(octstr_get_cstr(filename)); >> >> + if (data == NULL) >> + panic(0, "Cannot read file."); >> + >> /* >> * We test if this is a text/plain file with hex values in it. >> * Therefore copy the data and trail off any CR and LF from >> diff -rauw /gateway-cvs/test/test_regex.c /gateway/test/test_regex.c >> --- /gateway-cvs/test/test_regex.c 2009-01-14 10:24:22.000000000 +0100 >> +++ /gateway/test/test_regex.c 2009-02-06 14:40:11.000000000 +0100 >> @@ -81,6 +81,11 @@ >> >> get_and_set_debugs(argc, argv, NULL); >> >> + if (argc < 4) { >> + printf("Syntax: %s <os> <re> <sub>\n", argv[0]); >> + return -1; >> + } >> + >> os = octstr_create(argv[1]); >> re = octstr_create(argv[2]); >> sub = octstr_create(argv[3]); > > > -- Telemaque - 06560 SOPHIA-ANTIPOLIS - (FR) Service Technique/Reseau - NOC Direction du Developpement xMS+ http://www.telemaque.fr/ [email protected] Tel : +33 4 92 90 99 84 (fax 9142)