FreeBSD Bugzilla – Attachment 88838 Details for
Bug 125680
[patch] atacontrol(8): atacontrol depends on executable in /usr
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
atacontrol.diff
atacontrol.diff (text/x-diff), 1.27 KB, created by
Antoine Brodin
on 2008-07-20 22:37:13 UTC
(
hide
)
Description:
atacontrol.diff
Filename:
MIME Type:
Creator:
Antoine Brodin
Created:
2008-07-20 22:37:13 UTC
Size:
1.27 KB
patch
obsolete
>Index: sbin/atacontrol/atacontrol.c >=================================================================== >RCS file: /home/ncvs/src/sbin/atacontrol/atacontrol.c,v >retrieving revision 1.48 >diff -u -r1.48 atacontrol.c >--- sbin/atacontrol/atacontrol.c 15 May 2008 01:25:29 -0000 1.48 >+++ sbin/atacontrol/atacontrol.c 20 Jul 2008 21:18:35 -0000 >@@ -37,6 +37,7 @@ > #include <stdlib.h> > #include <string.h> > #include <sysexits.h> >+#include <unistd.h> > > static const char * > mode2str(int mode) >@@ -517,12 +518,29 @@ > if (ioctl(fd, IOCATARAIDREBUILD, &array) < 0) > warn("ioctl(IOCATARAIDREBUILD)"); > else { >- char buffer[128]; >- sprintf(buffer, "/usr/bin/nice -n 20 /bin/dd " >- "if=/dev/ar%d of=/dev/null bs=1m &", >- array); >- if (system(buffer)) >- warn("background dd"); >+ char device[64]; >+ char *buffer; >+ int arfd; >+ >+ switch (fork()) { >+ case -1: >+ err(1, "fork"); >+ case 0: >+ nice(20); >+ snprintf(device, sizeof(device), "/dev/ar%d", >+ array); >+ if ((arfd = open(device, O_RDONLY)) == -1) >+ err(1, "open %s", device); >+ if ((buffer = malloc(1024 * 1024)) == NULL) >+ err(1, "malloc"); >+ while (read(arfd, buffer, 1024 * 1024) > 0) >+ ; >+ free(buffer); >+ close(arfd); >+ break; >+ default: >+ break; >+ } > } > exit(EX_OK); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 125680
: 88838