aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/utility.c b/utility.c
index 9b805ae7d..794a9281a 100644
--- a/utility.c
+++ b/utility.c
@@ -1313,11 +1313,11 @@ extern pid_t* find_pid_by_name( char* pidName)
1313 /* open device */ 1313 /* open device */
1314 fd = open(device, O_RDONLY); 1314 fd = open(device, O_RDONLY);
1315 if (fd < 0) 1315 if (fd < 0)
1316 error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno)); 1316 perror_msg_and_die( "open failed for `%s'", device);
1317 1317
1318 /* Find out how many processes there are */ 1318 /* Find out how many processes there are */
1319 if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0) 1319 if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
1320 error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); 1320 perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
1321 1321
1322 /* Allocate some memory -- grab a few extras just in case 1322 /* Allocate some memory -- grab a few extras just in case
1323 * some new processes start up while we wait. The kernel will 1323 * some new processes start up while we wait. The kernel will
@@ -1328,7 +1328,7 @@ extern pid_t* find_pid_by_name( char* pidName)
1328 1328
1329 /* Now grab the pid list */ 1329 /* Now grab the pid list */
1330 if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0) 1330 if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
1331 error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); 1331 perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
1332 1332
1333 /* Now search for a match */ 1333 /* Now search for a match */
1334 for (i=1, j=0; i<pid_array[0] ; i++) { 1334 for (i=1, j=0; i<pid_array[0] ; i++) {
@@ -1337,7 +1337,7 @@ extern pid_t* find_pid_by_name( char* pidName)
1337 1337
1338 info.pid = pid_array[i]; 1338 info.pid = pid_array[i];
1339 if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0) 1339 if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
1340 error_msg_and_die( "\nDEVPS_GET_PID_INFO: %s\n", strerror (errno)); 1340 perror_msg_and_die( "\nDEVPS_GET_PID_INFO");
1341 1341
1342 /* Make sure we only match on the process name */ 1342 /* Make sure we only match on the process name */
1343 p=info.command_line+1; 1343 p=info.command_line+1;
@@ -1361,7 +1361,7 @@ extern pid_t* find_pid_by_name( char* pidName)
1361 1361
1362 /* close device */ 1362 /* close device */
1363 if (close (fd) != 0) 1363 if (close (fd) != 0)
1364 error_msg_and_die( "close failed for `%s': %s\n",device, strerror (errno)); 1364 perror_msg_and_die( "close failed for `%s'", device);
1365 1365
1366 return pidList; 1366 return pidList;
1367} 1367}
@@ -1387,7 +1387,7 @@ extern pid_t* find_pid_by_name( char* pidName)
1387 1387
1388 dir = opendir("/proc"); 1388 dir = opendir("/proc");
1389 if (!dir) 1389 if (!dir)
1390 error_msg_and_die( "Cannot open /proc: %s\n", strerror (errno)); 1390 perror_msg_and_die( "Cannot open /proc");
1391 1391
1392 while ((next = readdir(dir)) != NULL) { 1392 while ((next = readdir(dir)) != NULL) {
1393 FILE *status; 1393 FILE *status;
@@ -1764,7 +1764,7 @@ FILE *wfopen(const char *path, const char *mode)
1764{ 1764{
1765 FILE *fp; 1765 FILE *fp;
1766 if ((fp = fopen(path, mode)) == NULL) { 1766 if ((fp = fopen(path, mode)) == NULL) {
1767 error_msg("%s: %s\n", path, strerror(errno)); 1767 perror_msg("%s", path);
1768 errno = 0; 1768 errno = 0;
1769 } 1769 }
1770 return fp; 1770 return fp;
@@ -1778,7 +1778,7 @@ FILE *xfopen(const char *path, const char *mode)
1778{ 1778{
1779 FILE *fp; 1779 FILE *fp;
1780 if ((fp = fopen(path, mode)) == NULL) 1780 if ((fp = fopen(path, mode)) == NULL)
1781 error_msg_and_die("%s: %s\n", path, strerror(errno)); 1781 perror_msg_and_die("%s", path);
1782 return fp; 1782 return fp;
1783} 1783}
1784#endif 1784#endif