Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/lib/sh/zmapfd.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||
12 | extern ssize_t zread (int, char *, size_t); | - | ||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||
16 | int | - | ||||||||||||||||||||||||
17 | zmapfd (fd, ostr, fn) | - | ||||||||||||||||||||||||
18 | int fd; | - | ||||||||||||||||||||||||
19 | char **ostr; | - | ||||||||||||||||||||||||
20 | char *fn; | - | ||||||||||||||||||||||||
21 | { | - | ||||||||||||||||||||||||
22 | ssize_t nr; | - | ||||||||||||||||||||||||
23 | int rval; | - | ||||||||||||||||||||||||
24 | char lbuf[128]; | - | ||||||||||||||||||||||||
25 | char *result; | - | ||||||||||||||||||||||||
26 | int rsize, rind; | - | ||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||
28 | rval = 0; | - | ||||||||||||||||||||||||
29 | result = (char *)sh_xmalloc((rsize = 64), "zmapfd.c", 56); | - | ||||||||||||||||||||||||
30 | rind = 0; | - | ||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||
32 | while (1) | - | ||||||||||||||||||||||||
33 | { | - | ||||||||||||||||||||||||
34 | nr = zread (fd, lbuf, sizeof (lbuf)); | - | ||||||||||||||||||||||||
35 | if (nr == 0
| 6-20 | ||||||||||||||||||||||||
36 | { | - | ||||||||||||||||||||||||
37 | rval = rind; | - | ||||||||||||||||||||||||
38 | break; executed 20 times by 1 test: break; Executed by:
| 20 | ||||||||||||||||||||||||
39 | } | - | ||||||||||||||||||||||||
40 | else if (nr < 0
| 0-6 | ||||||||||||||||||||||||
41 | { | - | ||||||||||||||||||||||||
42 | sh_xfree((result), "zmapfd.c", 69); | - | ||||||||||||||||||||||||
43 | if (ostr
| 0 | ||||||||||||||||||||||||
44 | * never executed: ostr = (char *)*ostr = (char *) ((void *)0) ; never executed: *ostr = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||
45 | ((void *)0) never executed: *ostr = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||
46 | ; never executed: *ostr = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||
47 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
48 | } | - | ||||||||||||||||||||||||
49 | - | |||||||||||||||||||||||||
50 | do { if ((
never executed: result = sh_xrealloc((result), (rsize), "zmapfd.c", 75); }rsize += (128); never executed: } while (0);end of block | 0-6 | ||||||||||||||||||||||||
51 | memcpy (result+rind, lbuf, nr); | - | ||||||||||||||||||||||||
52 | rind += nr; | - | ||||||||||||||||||||||||
53 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||
54 | - | |||||||||||||||||||||||||
55 | do { if ((
never executed: result = sh_xrealloc((result), (rsize), "zmapfd.c", 80); }rsize += (128); never executed: } while (0);end of block | 0-20 | ||||||||||||||||||||||||
56 | result[rind] = '\0'; | - | ||||||||||||||||||||||||
57 | - | |||||||||||||||||||||||||
58 | if (ostr
| 0-20 | ||||||||||||||||||||||||
59 | * executed 20 times by 1 test: ostr = result;*ostr = result; Executed by:
executed 20 times by 1 test: *ostr = result; Executed by:
| 20 | ||||||||||||||||||||||||
60 | else | - | ||||||||||||||||||||||||
61 | sh_xfree((result), "zmapfd.c", 86); never executed: sh_xfree((result), "zmapfd.c", 86); | 0 | ||||||||||||||||||||||||
62 | - | |||||||||||||||||||||||||
63 | return executed 20 times by 1 test: rval;return rval; Executed by:
executed 20 times by 1 test: return rval; Executed by:
| 20 | ||||||||||||||||||||||||
64 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |