return NO_CONNECTION;
}
memset(buf, '\0', sizeof(buf));
- while ((n_read = read(sock, buf, BUFSIZ)) > 0) {
- n_read = n_read < BUFSIZ ? n_read : BUFSIZ - 1;
+ while ((n_read = read(sock, buf, BUFSIZ - 1)) > 0) {
buf[n_read] = '\0';
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = '\0';
}
g_free(command);
memset(buf, '\0', sizeof(buf));
- while ((n_read = read(sock, buf, BUFSIZ)) > 0) {
- n_read = n_read < BUFSIZ ? n_read : BUFSIZ - 1;
+ while ((n_read = read(sock, buf, BUFSIZ - 1)) > 0) {
buf[n_read] = '\0';
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = '\0';