projects
/
gapil.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Risistemato tutto il primo esempio di server echo e le funzioni FullWrite e
[gapil.git]
/
sources
/
TCP_echod.c
diff --git
a/sources/TCP_echod.c
b/sources/TCP_echod.c
index 049155744c919942c335a3a5f3b818ce0005990f..83d0c738f294743dd66478dfcb9b17d0e0bc7548 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.
8 2003/07/27 14:28:19
piccardi Exp $
+ * $Id: TCP_echod.c,v 1.
9 2003/07/27 23:41:04
piccardi Exp $
*
****************************************************************/
/*
*
****************************************************************/
/*
@@
-41,7
+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 <string.h> /* error
strings
*/
#include "Gapil.h"
#define BACKLOG 10
#include "Gapil.h"
#define BACKLOG 10
@@
-209,7
+209,7
@@
void ServEcho(int sockfd) {
}
}
nwrite = FullWrite(sockfd, buffer, nread);
}
}
nwrite = FullWrite(sockfd, buffer, nread);
- if (nwrite
< 0
) {
+ if (nwrite) {
snprintf(debug, MAXLINE+20, "Errore in scrittura: %s \n",
strerror(errno));
if (demonize) { /* daemon mode */
snprintf(debug, MAXLINE+20, "Errore in scrittura: %s \n",
strerror(errno));
if (demonize) { /* daemon mode */
@@
-234,8
+234,8
@@
void ServEcho(int sockfd) {
* routine to print error on stout or syslog
*/
void PrintErr(char * error) {
* routine to print error on stout or syslog
*/
void PrintErr(char * error) {
- if (demonize) { /* daemon mode */
- syslog(LOG_ERR,
error);
+ if (demonize) {
/* daemon mode */
+ syslog(LOG_ERR,
"%s: %m", error); /* log string and error message */
} else {
perror(error);
}
} else {
perror(error);
}