diff options
| author | Denys Vlasenko <dvlasenk@redhat.com> | 2011-08-20 12:48:18 +0200 |
|---|---|---|
| committer | Denys Vlasenko <dvlasenk@redhat.com> | 2011-08-23 12:53:01 +0200 |
| commit | 5d64581e106f47c474707001f924ee15ef22830b (patch) | |
| tree | 360b596fa1911aae10f6b0293f9dee935c496bf9 /test | |
| parent | 6b6ed5d669c04fb949dfc88ed0571e3db0d11571 (diff) | |
| download | strace-5d64581e106f47c474707001f924ee15ef22830b.tar.gz strace-5d64581e106f47c474707001f924ee15ef22830b.tar.bz2 strace-5d64581e106f47c474707001f924ee15ef22830b.tar.xz | |
Improve code readability by avoiding assignments inside if()
* desc.c (decode_select): Move assignment out of if() condition.
* file.c (sprinttime): Likewise.
(sys_getdirentries): Likewise.
* io.c (sys_ioctl): Likewise.
* strace.c (test_ptrace_setoptions_followfork): Likewise.
(main): Likewise.
(proc_open): Likewise.
(detach): Likewise.
(proc_poll): Likewise.
(trace): Likewise.
* syscall.c (qualify): Likewise.
(sys_indir): Likewise.
* test/procpollable.c (main): Likewise.
* test/sfd.c (main): Likewise.
* time.c (printtv_bitness): Likewise.
(sprinttv): Likewise.
(print_timespec): Likewise.
(void sprint_timespec): Likewise.
(printitv_bitness): Likewise.
* util.c (dumpstr): Likewise.
(umovestr): Likewise.
(fixvfork): Likewise.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/procpollable.c | 6 | ||||
| -rw-r--r-- | test/sfd.c | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/test/procpollable.c b/test/procpollable.c index a841af1..7bc5efa 100644 --- a/test/procpollable.c +++ b/test/procpollable.c @@ -12,14 +12,16 @@ int main(int argc, char *argv[]) FILE *pfp; struct pollfd pfd; - if ((pid = fork()) == 0) { + pid = fork(); + if (pid == 0) { pause(); exit(0); } sprintf(proc, "/proc/%d", pid); - if ((pfp = fopen(proc, "r+")) == NULL) + pfp = fopen(proc, "r+"); + if (pfp == NULL) goto fail; if (ioctl(fileno(pfp), PIOCSTOP, NULL) < 0) @@ -13,7 +13,8 @@ int main(int argc, char *argv[]) sprintf(sname, "/proc/%d/stat", pid); - if ((sfd = open(sname, O_RDONLY)) == -1) { + sfd = open(sname, O_RDONLY); + if (sfd == -1) { perror(sname); return 1; } |
