X-Git-Url: http://git.onelab.eu/?p=vsys-scripts.git;a=blobdiff_plain;f=slice-context%2Fsrc%2Fvsys.c;fp=slice-context%2Fsrc%2Fvsys.c;h=dbe8f14061429a0974b9e0c446f110f070e90733;hp=186e47f6b5658493897736d2d0560c1013d43fe1;hb=350a4faf4c30082f4087e6b1bf716c63719dfe6d;hpb=415b612c9d4eaa4d28846108b7468ad08fa6be2e;ds=sidebyside diff --git a/slice-context/src/vsys.c b/slice-context/src/vsys.c index 186e47f..dbe8f14 100644 --- a/slice-context/src/vsys.c +++ b/slice-context/src/vsys.c @@ -190,7 +190,7 @@ static int _fifo_push (const char *fifo_in, const char *fifo_out, } // send inputs to the fifo_in - fprintf (in, input); + fprintf (in, "%s", input); // force flush and close the fifo_in so the program on the other side // can process input. @@ -199,7 +199,7 @@ static int _fifo_push (const char *fifo_in, const char *fifo_out, nbytes = fread(msg, SIZE, 1, out); // the error buffer will not be empty if we read an error - if (strcmp(msg, "") != 0){ + if ((nbytes > 0) && (strcmp(msg, "") != 0)) { // an errror was read from the fifo_out ... return -3; } @@ -281,7 +281,7 @@ int _fd_tuntap(int if_type, int no_pi, char *if_name) { vsys_sock = socket (AF_UNIX, SOCK_STREAM, 0); if (vsys_sock == -1){ - snprintf (if_name, SIZE, strerror(errno)); + snprintf (if_name, SIZE, "%s", strerror(errno)); return -2; } @@ -294,7 +294,7 @@ int _fd_tuntap(int if_type, int no_pi, char *if_name) { sizeof(struct sockaddr_un)); if (ret == -1){ - snprintf (if_name, SIZE, strerror(errno)); + snprintf (if_name, SIZE, "%s", strerror(errno)); return -3; } @@ -321,7 +321,7 @@ int _fd_tuntap(int if_type, int no_pi, char *if_name) { ret = ioctl (fd, TUNGETIFF, (void *)&ifr); if (ret == -1){ close (fd); - snprintf (if_name, SIZE, strerror(errno)); + snprintf (if_name, SIZE, "%s", strerror(errno)); return -6; } @@ -338,7 +338,7 @@ int _fd_tuntap(int if_type, int no_pi, char *if_name) { ret = ioctl (fd, TUNSETIFF, (void *)&ifr); if (ret == -1){ close (fd); - snprintf (if_name, SIZE, strerror(errno)); + snprintf (if_name, SIZE, "%s", strerror(errno)); return -7; } */