- nswap = swapctl(SWAP_NSWAP, 0, 0);
- if (nswap < 1)
- fprintf(stderr, "swaptctl 'SWAP_NSWAP': %s\n", strerror(errno));
-
- fsep = sep = calloc(nswap, sizeof(*sep));
- if (sep == NULL)
- fprintf(stderr, "calloc 'nswap': %s\n", strerror(errno));
-
- rnswap = swapctl(SWAP_STATS, (void *)sep, nswap);
- if (rnswap < 0)
- fprintf(stderr, "swapctl 'SWAP_STATA': %s\n", strerror(errno));
-
- if (nswap != rnswap)
- fprintf(stderr, "SWAP_STATS != SWAP_NSWAP\n");
+ if ((nswap = swapctl(SWAP_NSWAP, 0, 0)) < 1) {
+ warn("swaptctl 'SWAP_NSWAP':");
+ return 1;
+ }
+ if (!(fsep = sep = calloc(nswap, sizeof(*sep)))) {
+ warn("calloc 'nswap':");
+ return 1;
+ }
+ if ((rnswap = swapctl(SWAP_STATS, (void *)sep, nswap)) < 0) {
+ warn("swapctl 'SWAP_STATA':");
+ return 1;
+ }
+ if (nswap != rnswap) {
+ warn("getstats: SWAP_STATS != SWAP_NSWAP");
+ return 1;
+ }