kern/75211: Vinum writes several errors to stdout.
Steinar Hamre
steinarh at pvv.ntnu.no
Fri Dec 17 18:40:39 PST 2004
>Number: 75211
>Category: kern
>Synopsis: Vinum writes several errors to stdout.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Dec 18 02:40:35 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Steinar Hamre
>Release: FreeBSD 5.3-STABLE i386
>Organization:
Programvareverkstedet
>Environment:
System: FreeBSD sulle.pvv.ntnu.no 5.3-STABLE FreeBSD 5.3-STABLE #47: Fri Oct 29 01:05:47 CEST 2004 root at sulle.pvv.ntnu.no:/usr/obj/usr/src/sys/SULLE i386
>Description:
In some error situations vinum logs errors to stdout.
This is incovenient as vinum is often used from shell scrips and
in such scrips stdout is almost always routed saved to a file or
routed to /dev/null. (The output from each new vinum create can
easily be more than 1000 lines on a system with a few hundred
partitions.)
>How-To-Repeat:
>Fix:
Index: v.c
===================================================================
RCS file: /home/ncvs/src/sbin/vinum/Attic/v.c,v
retrieving revision 1.40
diff -u -r1.40 v.c
--- v.c 16 Feb 2004 09:23:59 -0000 1.40
+++ v.c 18 Dec 2004 02:31:35 -0000
@@ -658,7 +658,7 @@
}
exit(0); /* when told to die */
} else if (pid < 0) /* couldn't fork */
- printf("Can't fork to check daemon\n");
+ fprintf(stderr, "Can't fork to check daemon\n");
}
void
Index: commands.c
===================================================================
RCS file: /home/ncvs/src/sbin/vinum/Attic/commands.c,v
retrieving revision 1.60
diff -u -r1.60 commands.c
--- commands.c 24 Jul 2004 19:11:40 -0000 1.60
+++ commands.c 18 Dec 2004 02:03:26 -0000
@@ -93,7 +93,7 @@
return;
}
if (ioctl(superdev, VINUM_STARTCONFIG, &force)) { /* can't get config? */
- printf("Can't configure: %s (%d)\n", strerror(errno), errno);
+ fprintf(stderr, "Can't configure: %s (%d)\n", strerror(errno), errno);
return;
}
file_line = 0; /* start with line 1 */
@@ -277,7 +277,7 @@
for (objindex = 0; objindex < argc; objindex++) {
objno = find_object(argv[objindex], &type); /* find the object */
if (objno < 0)
- printf("Can't find %s\n", argv[objindex]);
+ fprintf(stderr, "Can't find %s\n", argv[objindex]);
else {
switch (type) {
case volume_object:
@@ -293,7 +293,7 @@
break;
default:
- printf("Can't initialize %s: wrong object type\n", argv[objindex]);
+ fprintf(stderr, "Can't initialize %s: wrong object type\n", argv[objindex]);
break;
}
}
@@ -334,7 +334,7 @@
pid = fork(); /* into the background with you */
if (pid != 0) { /* I'm the parent, or we failed */
if (pid < 0) /* failure */
- printf("Couldn't fork: %s", strerror(errno));
+ fprintf(stderr, "Couldn't fork: %s", strerror(errno));
close(plexfh); /* we don't need this any more */
return;
}
@@ -356,7 +356,7 @@
&& (errno == ECHILD)) /* all gone */
break;
if (WEXITSTATUS(status) != 0) { /* oh, oh */
- printf("child %d exited with status 0x%x\n", pid, WEXITSTATUS(status));
+ fprintf(stderr, "child %d exited with status 0x%x\n", pid, WEXITSTATUS(status));
failed++;
}
}
@@ -389,7 +389,7 @@
if (pid > 0) /* I'm the parent */
return;
else if (pid < 0) { /* failure */
- printf("couldn't fork for subdisk %d: %s", sdno, strerror(errno));
+ fprintf(stderr, "couldn't fork for subdisk %d: %s", sdno, strerror(errno));
return;
}
}
@@ -1318,7 +1318,7 @@
int ioctltype;
if (argc != 0) {
- printf("usage: saveconfig\n");
+ fprintf(stderr, "usage: saveconfig\n");
return;
}
ioctltype = 1; /* user saveconfig */
@@ -1420,7 +1420,7 @@
reply = (struct _ioctl_reply *) &buffer;
if (ioctl(superdev, VINUM_STARTCONFIG, &force)) { /* can't get config? */
- printf("Can't configure: %s (%d)\n", strerror(errno), errno);
+ fprintf(stderr, "Can't configure: %s (%d)\n", strerror(errno), errno);
return;
}
if (!objectname) /* we need a name for our object */
@@ -1535,7 +1535,7 @@
return;
}
if (ioctl(superdev, VINUM_STARTCONFIG, &force)) { /* can't get config? */
- printf("Can't configure: %s (%d)\n", strerror(errno), errno);
+ fprintf(stderr, "Can't configure: %s (%d)\n", strerror(errno), errno);
return;
}
if (!objectname) /* we need a name for our object */
@@ -1678,7 +1678,7 @@
return;
}
if (ioctl(superdev, VINUM_STARTCONFIG, &force)) { /* can't get config? */
- printf("Can't configure: %s (%d)\n", strerror(errno), errno);
+ fprintf(stderr, "Can't configure: %s (%d)\n", strerror(errno), errno);
return;
}
if (!objectname) /* we need a name for our object */
@@ -1821,7 +1821,7 @@
return;
}
if (ioctl(superdev, VINUM_STARTCONFIG, &force)) { /* can't get config? */
- printf("Can't configure: %s (%d)\n", strerror(errno), errno);
+ fprintf(stderr, "Can't configure: %s (%d)\n", strerror(errno), errno);
return;
}
if (!objectname) /* we need a name for our object */
@@ -1979,7 +1979,7 @@
return;
}
if (ioctl(superdev, VINUM_STARTCONFIG, &force)) { /* can't get config? */
- printf("Can't configure: %s (%d)\n", strerror(errno), errno);
+ fprintf(stderr, "Can't configure: %s (%d)\n", strerror(errno), errno);
return;
}
if (!objectname) /* we need a name for our object */
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list