Package: vlan
Version: 1.8-2

Vconfig doesn't report error conditions in its exit status. This is
quite unpleasant in scripts. Example:

# vconfig add eth1 2 && echo foobar
ERROR: trying to add VLAN #2 to IF -:eth1:-  error: Invalid argument
foobar

I suggest applying the patch below.

thanks,

Eric


--- vconfig.c.orig      2005-07-29 10:25:20.069284000 -0400
+++ vconfig.c   2005-07-29 10:26:10.843355731 -0400
@@ -170,6 +170,7 @@
       // MATHIEU
       //cerr << "ERROR:  Could not open /proc/vlan/config.\n";
       fprintf(stderr,"WARNING:  Could not open /proc/net/vlan/config.  Maybe 
you need to load the 8021q module, or maybe you are not using PROCFS??\n");
+      exit(1);

    }
    else {
@@ -188,6 +189,7 @@
       if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
          fprintf(stderr,"ERROR: trying to add VLAN #%u to IF -:%s:-  error: 
%s\n",
                     vid, if_name, strerror(errno));
+         exit(1);
       }
       else {
          fprintf(stdout,"Added VLAN with VID == %u to IF -:%s:-\n",
@@ -202,6 +204,7 @@
       if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
          fprintf(stderr,"ERROR: trying to remove VLAN -:%s:- error: %s\n",
                  if_name, strerror(errno));
+         exit(1);
       }
       else {
          fprintf(stdout,"Removed VLAN -:%s:-\n", if_name);
@@ -212,6 +215,7 @@
       if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
          fprintf(stderr,"ERROR: trying to set egress map on device -:%s:- 
error: %s\n",
                  if_name, strerror(errno));
+         exit(1);
       }
       else {
          fprintf(stdout,"Set egress mapping on device -:%s:- "
@@ -224,6 +228,7 @@
       if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
          fprintf(stderr,"ERROR: trying to set ingress map on device -:%s:- 
error: %s\n",
                  if_name, strerror(errno));
+         exit(1);
       }
       else {
          fprintf(stdout,"Set ingress mapping on device -:%s:- "
@@ -236,6 +241,7 @@
       if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
          fprintf(stderr,"ERROR: trying to set flag on device -:%s:- error: 
%s\n",
                  if_name, strerror(errno));
+         exit(1);
       }
       else {
          fprintf(stdout,"Set flag on device -:%s:- "
@@ -248,6 +254,7 @@
       if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
          fprintf(stderr,"ERROR: trying to set name type for VLAN subsystem, 
error: %s\n",
                  strerror(errno));
+         exit(1);
       }
       else {
          fprintf(stdout,"Set name-type for VLAN subsystem."


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to