X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=blobdiff_plain;f=src%2Fmisc-progs%2Fqosctrl.c;h=8a8f07ebc099eb5c17613bf4c89f1bfc5a8a1a06;hp=023655715e075f90ca154186a00a1eccfb1ba97d;hb=903310c40dd5979d2d4325702e0ff7569efeb027;hpb=f7c162140c0df1322f80e34e91eace1ee3853a65 diff --git a/src/misc-progs/qosctrl.c b/src/misc-progs/qosctrl.c index 023655715e..8a8f07ebc0 100644 --- a/src/misc-progs/qosctrl.c +++ b/src/misc-progs/qosctrl.c @@ -16,7 +16,6 @@ int main(int argc, char *argv[]) { int fd = -1; - int enable = 0; if (!(initsetuid())) exit(1); @@ -25,18 +24,17 @@ int main(int argc, char *argv[]) { fprintf(stderr, "\nNo argument given.\n\nqosctrl (start|stop|restart|status|generate)\n\n"); exit(1); } - + + if ((fd = open("/var/ipfire/qos/bin/qos.sh", O_RDONLY)) != -1) { + close(fd); + } else { + // If there is no qos.sh do nothing. + exit(0); + } + safe_system("chmod 755 /var/ipfire/qos/bin/qos.sh &>/dev/null"); if (strcmp(argv[1], "start") == 0) { - if ((fd = open("/var/ipfire/qos/bin/qos.sh", O_RDONLY)) != -1) - { - close(fd); - enable = 1; - } - if (enable) - { - safe_system("/var/ipfire/qos/bin/qos.sh start"); - } + safe_system("/var/ipfire/qos/bin/qos.sh start"); } else if (strcmp(argv[1], "stop") == 0) { safe_system("/var/ipfire/qos/bin/qos.sh clear"); } else if (strcmp(argv[1], "status") == 0) {