}
// 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.
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;
}
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;
}
sizeof(struct sockaddr_un));
if (ret == -1){
- snprintf (if_name, SIZE, strerror(errno));
+ snprintf (if_name, SIZE, "%s", strerror(errno));
return -3;
}
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;
}
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;
}
*/