projects
/
gapil.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Modifiche varie per i test delle situazioni limite
[gapil.git]
/
sources
/
TCP_echod.c
diff --git
a/sources/TCP_echod.c
b/sources/TCP_echod.c
index 576c47f2069ac3d03bcd2b177af409d20f9c9bdb..049155744c919942c335a3a5f3b818ce0005990f 100644
(file)
--- a/
sources/TCP_echod.c
+++ b/
sources/TCP_echod.c
@@
-26,7
+26,7
@@
*
* Usage: echod -h give all info
*
*
* Usage: echod -h give all info
*
- * $Id: TCP_echod.c,v 1.
7 2003/06/19 14:18:27
piccardi Exp $
+ * $Id: TCP_echod.c,v 1.
8 2003/07/27 14:28:19
piccardi Exp $
*
****************************************************************/
/*
*
****************************************************************/
/*
@@
-41,6
+41,7
@@
#include <syslog.h> /* syslog system functions */
#include <signal.h> /* signal functions */
#include <errno.h> /* error code */
#include <syslog.h> /* syslog system functions */
#include <signal.h> /* signal functions */
#include <errno.h> /* error code */
+#include <string.h> /* error code */
#include "Gapil.h"
#define BACKLOG 10
#include "Gapil.h"
#define BACKLOG 10
@@
-198,7
+199,25
@@
void ServEcho(int sockfd) {
int size;
/* main loop, reading 0 char means client close connection */
while ( (nread = read(sockfd, buffer, MAXLINE)) != 0) {
int size;
/* main loop, reading 0 char means client close connection */
while ( (nread = read(sockfd, buffer, MAXLINE)) != 0) {
+ if (nread < 0) {
+ snprintf(debug, MAXLINE+20, "Errore in lettura: %s \n",
+ strerror(errno));
+ if (demonize) { /* daemon mode */
+ syslog(LOG_DEBUG, debug);
+ } else {
+ printf("%s", debug);
+ }
+ }
nwrite = FullWrite(sockfd, buffer, nread);
nwrite = FullWrite(sockfd, buffer, nread);
+ if (nwrite < 0) {
+ snprintf(debug, MAXLINE+20, "Errore in scrittura: %s \n",
+ strerror(errno));
+ if (demonize) { /* daemon mode */
+ syslog(LOG_DEBUG, debug);
+ } else {
+ printf("%s", debug);
+ }
+ }
if (debugging) {
buffer[nread] = 0;
snprintf(debug, MAXLINE+20, "Letti %d byte, %s", nread, buffer);
if (debugging) {
buffer[nread] = 0;
snprintf(debug, MAXLINE+20, "Letti %d byte, %s", nread, buffer);