Changeset 89ac5513 in mainline for uspace/app
- Timestamp:
- 2013-06-23T19:54:53Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ddb1922
- Parents:
- 3abf0760 (diff), 96cbd18 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/app
- Files:
-
- 4 added
- 4 deleted
- 13 edited
-
bdsh/Makefile (modified) (2 diffs)
-
bdsh/cmds/modules/bdd/bdd.c (deleted)
-
bdsh/cmds/modules/bdd/bdd.h (deleted)
-
bdsh/cmds/modules/bdd/bdd_def.h (deleted)
-
bdsh/cmds/modules/bdd/entry.h (deleted)
-
bdsh/cmds/modules/cmp/cmp.c (modified) (1 diff)
-
bdsh/cmds/modules/modules.h (modified) (2 diffs)
-
bdsh/cmds/modules/sleep/sleep.c (modified) (1 diff)
-
blkdump/blkdump.c (modified) (9 diffs)
-
dnscfg/Makefile (added)
-
dnscfg/dnscfg.c (added)
-
dnsres/Makefile (added)
-
dnsres/dnsres.c (added)
-
inet/inet.c (modified) (9 diffs)
-
init/init.c (modified) (1 diff)
-
nettest1/nettest1.c (modified) (5 diffs)
-
nettest2/nettest2.c (modified) (5 diffs)
-
nettest3/nettest3.c (modified) (3 diffs)
-
nterm/conn.c (modified) (5 diffs)
-
nterm/nterm.c (modified) (1 diff)
-
ping/ping.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/Makefile
r3abf0760 r89ac5513 29 29 30 30 USPACE_PREFIX = ../.. 31 LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBCLUI_PREFIX)/libclui.a \ 32 $(LIBFMTUTIL_PREFIX)/libfmtutil.a 33 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBCLUI_PREFIX) \ 34 -I$(LIBFMTUTIL_PREFIX) -I. -Icmds/ -Icmds/builtins -Icmds/modules 31 LIBS = $(LIBCLUI_PREFIX)/libclui.a $(LIBFMTUTIL_PREFIX)/libfmtutil.a 32 EXTRA_CFLAGS = -I$(LIBCLUI_PREFIX) -I$(LIBFMTUTIL_PREFIX) \ 33 -I. -Icmds/ -Icmds/builtins -Icmds/modules 35 34 BINARY = bdsh 36 35 … … 40 39 cmds/modules/mkfile/mkfile.c \ 41 40 cmds/modules/rm/rm.c \ 42 cmds/modules/bdd/bdd.c \43 41 cmds/modules/cat/cat.c \ 44 42 cmds/modules/touch/touch.c \ -
uspace/app/bdsh/cmds/modules/cmp/cmp.c
r3abf0760 r89ac5513 107 107 108 108 if (offset[0] != offset[1] || 109 bcmp(buffer[0], buffer[1], offset[0])) {109 memcmp(buffer[0], buffer[1], offset[0]) != 0) { 110 110 rc = 1; 111 111 goto end; -
uspace/app/bdsh/cmds/modules/modules.h
r3abf0760 r89ac5513 50 50 #include "mkfile/entry.h" 51 51 #include "rm/entry.h" 52 #include "bdd/entry.h"53 52 #include "cat/entry.h" 54 53 #include "touch/entry.h" … … 74 73 #include "mkfile/mkfile_def.h" 75 74 #include "rm/rm_def.h" 76 #include "bdd/bdd_def.h"77 75 #include "cat/cat_def.h" 78 76 #include "touch/touch_def.h" -
uspace/app/bdsh/cmds/modules/sleep/sleep.c
r3abf0760 r89ac5513 67 67 uint64_t whole_seconds; 68 68 uint64_t frac_seconds; 69 c har *endptr;69 const char *endptr; 70 70 71 71 /* Check for whole seconds */ -
uspace/app/blkdump/blkdump.c
r3abf0760 r89ac5513 1 1 /* 2 2 * Copyright (c) 2011 Martin Sucha 3 * Copyright (c) 201 0Jiri Svoboda3 * Copyright (c) 2013 Jiri Svoboda 4 4 * All rights reserved. 5 5 * … … 52 52 53 53 static void syntax_print(void); 54 static int print_blocks(aoff64_t block_offset, aoff64_t block_count, size_t block_size); 55 static int print_toc(void); 54 56 static void print_hex_row(uint8_t *data, size_t length, size_t bytes_per_row); 57 58 static bool relative = false; 59 static service_id_t service_id; 55 60 56 61 int main(int argc, char **argv) … … 59 64 int rc; 60 65 char *dev_path; 61 service_id_t service_id;62 66 size_t block_size; 63 67 char *endptr; … … 65 69 aoff64_t block_count = 1; 66 70 aoff64_t dev_nblocks; 67 uint8_t *data; 68 size_t data_offset; 69 aoff64_t current; 70 aoff64_t limit; 71 bool relative = false; 71 bool toc = false; 72 72 73 73 if (argc < 2) { … … 79 79 --argc; ++argv; 80 80 81 if (str_cmp(*argv, "--toc") == 0) { 82 --argc; ++argv; 83 toc = true; 84 goto devname; 85 } 86 81 87 if (str_cmp(*argv, "--relative") == 0) { 82 88 --argc; ++argv; … … 120 126 } 121 127 128 devname: 122 129 if (argc != 1) { 123 130 printf(NAME ": Error, unexpected argument.\n"); … … 153 160 printf("Device %s has %" PRIuOFF64 " blocks, %" PRIuOFF64 " bytes each\n", dev_path, dev_nblocks, (aoff64_t) block_size); 154 161 162 if (toc) 163 rc = print_toc(); 164 else 165 rc = print_blocks(block_offset, block_count, block_size); 166 167 block_fini(service_id); 168 169 return rc; 170 } 171 172 static int print_blocks(aoff64_t block_offset, aoff64_t block_count, size_t block_size) 173 { 174 uint8_t *data; 175 aoff64_t current; 176 aoff64_t limit; 177 size_t data_offset; 178 int rc; 179 155 180 data = malloc(block_size); 156 181 if (data == NULL) { 157 182 printf(NAME ": Error allocating data buffer of %" PRIuOFF64 " bytes", (aoff64_t) block_size); 158 block_fini(service_id);159 183 return 3; 160 184 } 161 185 162 186 limit = block_offset + block_count; 163 187 for (current = block_offset; current < limit; current++) { … … 168 192 return 3; 169 193 } 170 194 171 195 printf("---- Block %" PRIuOFF64 " (at %" PRIuOFF64 ") ----\n", current, current*block_size); 172 196 173 197 for (data_offset = 0; data_offset < block_size; data_offset += 16) { 174 198 if (relative) { … … 183 207 printf("\n"); 184 208 } 185 209 186 210 free(data); 187 188 block_fini(service_id); 211 return 0; 212 } 213 214 static int print_toc(void) 215 { 216 toc_block_t *toc; 217 218 toc = block_get_toc(service_id, 0); 219 if (toc == NULL) 220 return 1; 221 222 printf("TOC size: %" PRIu16 " bytes\n", toc->size); 223 printf("First session: %" PRIu8 "\n", toc->first_session); 224 printf("Last_session: %" PRIu8 "\n", toc->last_session); 189 225 190 226 return 0; -
uspace/app/inet/inet.c
r3abf0760 r89ac5513 1 1 /* 2 * Copyright (c) 201 2Jiri Svoboda2 * Copyright (c) 2013 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 36 36 37 37 #include <errno.h> 38 #include <inet/addr.h> 38 39 #include <inet/inetcfg.h> 39 40 #include <loc.h> … … 54 55 } 55 56 56 static int naddr_parse(const char *text, inet_naddr_t *naddr)57 {58 unsigned long a[4], bits;59 char *cp = (char *)text;60 int i;61 62 for (i = 0; i < 3; i++) {63 a[i] = strtoul(cp, &cp, 10);64 if (*cp != '.')65 return EINVAL;66 ++cp;67 }68 69 a[3] = strtoul(cp, &cp, 10);70 if (*cp != '/')71 return EINVAL;72 ++cp;73 74 bits = strtoul(cp, &cp, 10);75 if (*cp != '\0')76 return EINVAL;77 78 naddr->ipv4 = 0;79 for (i = 0; i < 4; i++) {80 if (a[i] > 255)81 return EINVAL;82 naddr->ipv4 = (naddr->ipv4 << 8) | a[i];83 }84 85 if (bits > 31)86 return EINVAL;87 88 naddr->bits = bits;89 return EOK;90 }91 92 static int addr_parse(const char *text, inet_addr_t *addr)93 {94 unsigned long a[4];95 char *cp = (char *)text;96 int i;97 98 for (i = 0; i < 3; i++) {99 a[i] = strtoul(cp, &cp, 10);100 if (*cp != '.')101 return EINVAL;102 ++cp;103 }104 105 a[3] = strtoul(cp, &cp, 10);106 if (*cp != '\0')107 return EINVAL;108 109 addr->ipv4 = 0;110 for (i = 0; i < 4; i++) {111 if (a[i] > 255)112 return EINVAL;113 addr->ipv4 = (addr->ipv4 << 8) | a[i];114 }115 116 return EOK;117 }118 119 static int naddr_format(inet_naddr_t *naddr, char **bufp)120 {121 int rc;122 123 rc = asprintf(bufp, "%d.%d.%d.%d/%d", naddr->ipv4 >> 24,124 (naddr->ipv4 >> 16) & 0xff, (naddr->ipv4 >> 8) & 0xff,125 naddr->ipv4 & 0xff, naddr->bits);126 127 if (rc < 0)128 return ENOMEM;129 130 return EOK;131 }132 133 static int addr_format(inet_addr_t *addr, char **bufp)134 {135 int rc;136 137 rc = asprintf(bufp, "%d.%d.%d.%d", addr->ipv4 >> 24,138 (addr->ipv4 >> 16) & 0xff, (addr->ipv4 >> 8) & 0xff,139 addr->ipv4 & 0xff);140 141 if (rc < 0)142 return ENOMEM;143 144 return EOK;145 }146 147 57 static int addr_create_static(int argc, char *argv[]) 148 58 { … … 178 88 } 179 89 180 rc = naddr_parse(addr_spec, &naddr);90 rc = inet_naddr_parse(addr_spec, &naddr); 181 91 if (rc != EOK) { 182 92 printf(NAME ": Invalid network address format '%s'.\n", … … 267 177 route_name = argv[2]; 268 178 269 rc = naddr_parse(dest_str, &dest);179 rc = inet_naddr_parse(dest_str, &dest); 270 180 if (rc != EOK) { 271 181 printf(NAME ": Invalid network address format '%s'.\n", … … 274 184 } 275 185 276 rc = addr_parse(router_str, &router);186 rc = inet_addr_parse(router_str, &router); 277 187 if (rc != EOK) { 278 188 printf(NAME ": Invalid address format '%s'.\n", router_str); … … 366 276 } 367 277 368 rc = naddr_format(&ainfo.naddr, &astr);278 rc = inet_naddr_format(&ainfo.naddr, &astr); 369 279 if (rc != EOK) { 370 280 printf("Memory allocation failed.\n"); … … 430 340 } 431 341 432 rc = naddr_format(&srinfo.dest, &dest_str);342 rc = inet_naddr_format(&srinfo.dest, &dest_str); 433 343 if (rc != EOK) { 434 344 printf("Memory allocation failed.\n"); … … 437 347 } 438 348 439 rc = addr_format(&srinfo.router, &router_str);349 rc = inet_addr_format(&srinfo.router, &router_str); 440 350 if (rc != EOK) { 441 351 printf("Memory allocation failed.\n"); -
uspace/app/init/init.c
r3abf0760 r89ac5513 359 359 srv_start("/srv/tcp"); 360 360 srv_start("/srv/udp"); 361 srv_start("/srv/dnsrsrv"); 361 362 362 363 srv_start("/srv/clipboard"); -
uspace/app/nettest1/nettest1.c
r3abf0760 r89ac5513 46 46 #include <arg_parse.h> 47 47 48 #include <inet/dnsr.h> 48 49 #include <net/in.h> 49 50 #include <net/in6.h> … … 75 76 printf( 76 77 "Network Networking test 1 aplication - sockets\n" 77 "Usage: echo [options] numeric_address\n"78 "Usage: nettest1 [options] host\n" 78 79 "Where options are:\n" 79 80 "-f protocol_family | --family=protocol_family\n" … … 290 291 struct sockaddr_in address_in; 291 292 struct sockaddr_in6 address_in6; 293 dnsr_hostinfo_t *hinfo; 292 294 uint8_t *address_start; 293 295 … … 319 321 } 320 322 321 /* If not before the last argument containing the address*/323 /* If not before the last argument containing the host */ 322 324 if (index >= argc) { 323 printf("Command line error: missing address\n");325 printf("Command line error: missing host name\n"); 324 326 nettest1_print_help(); 325 327 return EINVAL; … … 348 350 } 349 351 350 /* Parse the last argument which should contain the address */352 /* Parse the last argument which should contain the host/address */ 351 353 rc = inet_pton(family, argv[argc - 1], address_start); 352 354 if (rc != EOK) { 353 fprintf(stderr, "Address parse error %d\n", rc); 354 return rc; 355 /* Try interpreting as a host name */ 356 rc = dnsr_name2host(argv[argc - 1], &hinfo); 357 if (rc != EOK) { 358 printf("Error resolving host '%s'.\n", argv[argc - 1]); 359 return rc; 360 } 361 362 rc = inet_addr_sockaddr_in(&hinfo->addr, &address_in); 363 if (rc != EOK) { 364 printf("Host '%s' not resolved as IPv4 address.\n", argv[argc - 1]); 365 return rc; 366 } 355 367 } 356 368 -
uspace/app/nettest2/nettest2.c
r3abf0760 r89ac5513 47 47 #include <stdbool.h> 48 48 49 #include <inet/dnsr.h> 49 50 #include <net/in.h> 50 51 #include <net/in6.h> … … 71 72 printf( 72 73 "Network Networking test 2 aplication - UDP transfer\n" 73 "Usage: echo [options] address\n"74 "Usage: nettest2 [options] host\n" 74 75 "Where options are:\n" 75 76 "-f protocol_family | --family=protocol_family\n" … … 227 228 struct sockaddr_in address_in; 228 229 struct sockaddr_in6 address_in6; 230 dnsr_hostinfo_t *hinfo; 229 231 socklen_t addrlen; 230 232 uint8_t *address_start; … … 265 267 } 266 268 267 /* If not before the last argument containing the address*/269 /* If not before the last argument containing the host */ 268 270 if (index >= argc) { 269 printf("Command line error: missing address\n");271 printf("Command line error: missing host name\n"); 270 272 nettest2_print_help(); 271 273 return EINVAL; … … 294 296 } 295 297 296 /* Parse the last argument which should contain the address.*/298 /* Parse the last argument which should contain the host/address */ 297 299 rc = inet_pton(family, argv[argc - 1], address_start); 298 300 if (rc != EOK) { 299 fprintf(stderr, "Address parse error %d\n", rc); 300 return rc; 301 /* Try interpreting as a host name */ 302 rc = dnsr_name2host(argv[argc - 1], &hinfo); 303 if (rc != EOK) { 304 printf("Error resolving host '%s'.\n", argv[argc - 1]); 305 return rc; 306 } 307 308 rc = inet_addr_sockaddr_in(&hinfo->addr, &address_in); 309 if (rc != EOK) { 310 printf("Host '%s' not resolved as IPv4 address.\n", argv[argc - 1]); 311 return rc; 312 } 301 313 } 302 314 -
uspace/app/nettest3/nettest3.c
r3abf0760 r89ac5513 39 39 #include <str.h> 40 40 41 #include <inet/dnsr.h> 41 42 #include <net/in.h> 42 43 #include <net/in6.h> … … 60 61 int fd; 61 62 char *endptr; 63 dnsr_hostinfo_t *hinfo; 62 64 63 65 port = 7; … … 75 77 rc = inet_pton(AF_INET, argv[1], (uint8_t *)&addr.sin_addr.s_addr); 76 78 if (rc != EOK) { 77 fprintf(stderr, "Error parsing address\n"); 78 return 1; 79 /* Try interpreting as a host name */ 80 rc = dnsr_name2host(argv[1], &hinfo); 81 if (rc != EOK) { 82 printf("Error resolving host '%s'.\n", argv[1]); 83 return rc; 84 } 85 86 rc = inet_addr_sockaddr_in(&hinfo->addr, &addr); 87 if (rc != EOK) { 88 printf("Host '%s' not resolved as IPv4 address.\n", argv[1]); 89 return rc; 90 } 79 91 } 80 92 printf("result: rc=%d, family=%d, addr=%x\n", rc, -
uspace/app/nterm/conn.c
r3abf0760 r89ac5513 33 33 */ 34 34 35 #include <byteorder.h> 35 36 #include <stdbool.h> 36 37 #include <errno.h> 37 38 #include <fibril.h> 39 #include <inet/dnsr.h> 38 40 #include <net/socket.h> 39 41 #include <stdio.h> … … 74 76 { 75 77 struct sockaddr_in addr; 78 dnsr_hostinfo_t *hinfo = NULL; 76 79 int rc; 77 80 char *endptr; … … 81 84 rc = inet_pton(addr.sin_family, addr_s, (uint8_t *)&addr.sin_addr); 82 85 if (rc != EOK) { 83 printf("Invalid addres %s\n", addr_s); 84 return EINVAL; 86 /* Try interpreting as a host name */ 87 rc = dnsr_name2host(addr_s, &hinfo); 88 if (rc != EOK) { 89 printf("Error resolving host '%s'.\n", addr_s); 90 goto error; 91 } 92 93 rc = inet_addr_sockaddr_in(&hinfo->addr, &addr); 94 if (rc != EOK) { 95 printf("Host '%s' not resolved as IPv4 address.\n", addr_s); 96 return rc; 97 } 85 98 } 86 99 … … 88 101 if (*endptr != '\0') { 89 102 printf("Invalid port number %s\n", port_s); 90 return EINVAL;103 goto error; 91 104 } 92 105 … … 95 108 goto error; 96 109 97 printf("Connecting to address%s port %u\n", addr_s, ntohs(addr.sin_port));110 printf("Connecting to host %s port %u\n", addr_s, ntohs(addr.sin_port)); 98 111 99 112 rc = connect(conn_fd, (struct sockaddr *)&addr, sizeof(addr)); -
uspace/app/nterm/nterm.c
r3abf0760 r89ac5513 104 104 static void print_syntax(void) 105 105 { 106 printf("syntax: nterm < ip-address> <port>\n");106 printf("syntax: nterm <host> <port>\n"); 107 107 } 108 108 -
uspace/app/ping/ping.c
r3abf0760 r89ac5513 1 1 /* 2 * Copyright (c) 201 2Jiri Svoboda2 * Copyright (c) 2013 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 37 37 #include <errno.h> 38 38 #include <fibril_synch.h> 39 #include <inet/dnsr.h> 40 #include <inet/addr.h> 39 41 #include <inet/inetping.h> 40 42 #include <io/console.h> … … 61 63 }; 62 64 63 static inet_addr_t src_addr;64 static inet_addr_t dest_addr;65 static uint32_t src; 66 static uint32_t dest; 65 67 66 68 static bool ping_repeat = false; … … 68 70 static void print_syntax(void) 69 71 { 70 printf("syntax: " NAME " [-r] <addr>\n"); 71 } 72 73 static int addr_parse(const char *text, inet_addr_t *addr) 74 { 75 unsigned long a[4]; 76 char *cp = (char *)text; 77 int i; 78 79 for (i = 0; i < 3; i++) { 80 a[i] = strtoul(cp, &cp, 10); 81 if (*cp != '.') 82 return EINVAL; 83 ++cp; 84 } 85 86 a[3] = strtoul(cp, &cp, 10); 87 if (*cp != '\0') 88 return EINVAL; 89 90 addr->ipv4 = 0; 91 for (i = 0; i < 4; i++) { 92 if (a[i] > 255) 93 return EINVAL; 94 addr->ipv4 = (addr->ipv4 << 8) | a[i]; 95 } 96 97 return EOK; 98 } 99 100 static int addr_format(inet_addr_t *addr, char **bufp) 101 { 102 int rc; 103 104 rc = asprintf(bufp, "%d.%d.%d.%d", addr->ipv4 >> 24, 105 (addr->ipv4 >> 16) & 0xff, (addr->ipv4 >> 8) & 0xff, 106 addr->ipv4 & 0xff); 107 108 if (rc < 0) 109 return ENOMEM; 110 111 return EOK; 72 printf("syntax: " NAME " [-r] <host>\n"); 112 73 } 113 74 … … 122 83 static int ping_ev_recv(inetping_sdu_t *sdu) 123 84 { 124 char *asrc, *adest; 125 int rc; 126 127 rc = addr_format(&sdu->src, &asrc); 85 inet_addr_t src_addr; 86 inet_addr_unpack(sdu->src, &src_addr); 87 88 inet_addr_t dest_addr; 89 inet_addr_unpack(sdu->dest, &dest_addr); 90 91 char *asrc; 92 int rc = inet_addr_format(&src_addr, &asrc); 128 93 if (rc != EOK) 129 94 return ENOMEM; 130 131 rc = addr_format(&sdu->dest, &adest); 95 96 char *adest; 97 rc = inet_addr_format(&dest_addr, &adest); 132 98 if (rc != EOK) { 133 99 free(asrc); 134 100 return ENOMEM; 135 101 } 102 136 103 printf("Received ICMP echo reply: from %s to %s, seq. no %u, " 137 104 "payload size %zu\n", asrc, adest, sdu->seq_no, sdu->size); 138 139 if (!ping_repeat) {105 106 if (!ping_repeat) 140 107 ping_signal_done(); 141 } 142 108 143 109 free(asrc); 144 110 free(adest); … … 151 117 int rc; 152 118 153 sdu.src = src _addr;154 sdu.dest = dest _addr;119 sdu.src = src; 120 sdu.dest = dest; 155 121 sdu.seq_no = seq_no; 156 122 sdu.data = (void *) "foo"; … … 213 179 int main(int argc, char *argv[]) 214 180 { 181 dnsr_hostinfo_t *hinfo = NULL; 182 char *asrc = NULL; 183 char *adest = NULL; 184 char *sdest = NULL; 215 185 int rc; 216 186 int argi; … … 220 190 printf(NAME ": Failed connecting to internet ping service " 221 191 "(%d).\n", rc); 222 return 1;192 goto error; 223 193 } 224 194 … … 233 203 if (argc - argi != 1) { 234 204 print_syntax(); 235 return 1;205 goto error; 236 206 } 237 207 238 208 /* Parse destination address */ 239 rc = addr_parse(argv[argi], &dest_addr); 240 if (rc != EOK) { 241 printf(NAME ": Invalid address format.\n"); 242 print_syntax(); 243 return 1; 244 } 245 209 inet_addr_t dest_addr; 210 rc = inet_addr_parse(argv[argi], &dest_addr); 211 if (rc != EOK) { 212 /* Try interpreting as a host name */ 213 rc = dnsr_name2host(argv[argi], &hinfo); 214 if (rc != EOK) { 215 printf(NAME ": Error resolving host '%s'.\n", argv[argi]); 216 goto error; 217 } 218 219 dest_addr = hinfo->addr; 220 } 221 222 rc = inet_addr_pack(&dest_addr, &dest); 223 if (rc != EOK) { 224 printf(NAME ": Destination '%s' is not an IPv4 address.\n", 225 argv[argi]); 226 goto error; 227 } 228 246 229 /* Determine source address */ 247 rc = inetping_get_srcaddr( &dest_addr, &src_addr);230 rc = inetping_get_srcaddr(dest, &src); 248 231 if (rc != EOK) { 249 232 printf(NAME ": Failed determining source address.\n"); 250 return 1; 251 } 233 goto error; 234 } 235 236 inet_addr_t src_addr; 237 inet_addr_unpack(src, &src_addr); 238 239 rc = inet_addr_format(&src_addr, &asrc); 240 if (rc != EOK) { 241 printf(NAME ": Out of memory.\n"); 242 goto error; 243 } 244 245 rc = inet_addr_format(&dest_addr, &adest); 246 if (rc != EOK) { 247 printf(NAME ": Out of memory.\n"); 248 goto error; 249 } 250 251 if (hinfo != NULL) { 252 rc = asprintf(&sdest, "%s (%s)", hinfo->cname, adest); 253 if (rc < 0) { 254 printf(NAME ": Out of memory.\n"); 255 goto error; 256 } 257 } else { 258 sdest = adest; 259 adest = NULL; 260 } 261 262 printf("Sending ICMP echo request from %s to %s.\n", 263 asrc, sdest); 252 264 253 265 fid_t fid; … … 257 269 if (fid == 0) { 258 270 printf(NAME ": Failed creating transmit fibril.\n"); 259 return 1;271 goto error; 260 272 } 261 273 … … 265 277 if (fid == 0) { 266 278 printf(NAME ": Failed creating input fibril.\n"); 267 return 1;279 goto error; 268 280 } 269 281 … … 283 295 if (rc == ETIMEOUT) { 284 296 printf(NAME ": Echo request timed out.\n"); 285 return 1; 286 } 287 297 goto error; 298 } 299 300 free(asrc); 301 free(adest); 302 free(sdest); 303 dnsr_hostinfo_destroy(hinfo); 288 304 return 0; 305 306 error: 307 free(asrc); 308 free(adest); 309 free(sdest); 310 dnsr_hostinfo_destroy(hinfo); 311 return 1; 289 312 } 290 313
Note:
See TracChangeset
for help on using the changeset viewer.
