aboutsummaryrefslogtreecommitdiff
path: root/util-linux/dmesg.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-12-22 01:48:07 +0000
committerMatt Kraai <kraai@debian.org>2000-12-22 01:48:07 +0000
commita9819b290848e0a760f3805d5937fa050235d707 (patch)
treeb8cb8d939032c0806d62161b01e5836cb808dc3f /util-linux/dmesg.c
parente9f07fb6e83b75a50760599a5d31f494841eddf7 (diff)
downloadbusybox-w32-a9819b290848e0a760f3805d5937fa050235d707.tar.gz
busybox-w32-a9819b290848e0a760f3805d5937fa050235d707.tar.bz2
busybox-w32-a9819b290848e0a760f3805d5937fa050235d707.zip
Use busybox error handling functions wherever possible.
Diffstat (limited to 'util-linux/dmesg.c')
-rw-r--r--util-linux/dmesg.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 1d33b7641..c220d9018 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -69,20 +69,16 @@ int dmesg_main(int argc, char **argv)
69 } 69 }
70 70
71 if (cmd == 8) { 71 if (cmd == 8) {
72 n = klogctl(cmd, NULL, level); 72 if (klogctl(cmd, NULL, level) < 0)
73 if (n < 0) { 73 perror_msg_and_die("klogctl");
74 goto klogctl_error;
75 }
76 return EXIT_SUCCESS; 74 return EXIT_SUCCESS;
77 } 75 }
78 76
79 if (bufsize < 4096) 77 if (bufsize < 4096)
80 bufsize = 4096; 78 bufsize = 4096;
81 buf = (char *) xmalloc(bufsize); 79 buf = (char *) xmalloc(bufsize);
82 n = klogctl(cmd, buf, bufsize); 80 if ((n = klogctl(cmd, buf, bufsize)) < 0)
83 if (n < 0) { 81 perror_msg_and_die("klogctl");
84 goto klogctl_error;
85 }
86 82
87 lastc = '\n'; 83 lastc = '\n';
88 for (i = 0; i < n; i++) { 84 for (i = 0; i < n; i++) {
@@ -102,7 +98,4 @@ int dmesg_main(int argc, char **argv)
102 end: 98 end:
103 usage(dmesg_usage); 99 usage(dmesg_usage);
104 return EXIT_FAILURE; 100 return EXIT_FAILURE;
105 klogctl_error:
106 perror("klogctl");
107 return EXIT_FAILURE;
108} 101}