From 29b331b4375c1e07fee0e943ec90c3a855b6d428 Mon Sep 17 00:00:00 2001
From: Guo Wenxue <guowenxue@gmail.com>
Date: Fri, 08 Sep 2023 09:59:40 +0800
Subject: [PATCH] Update socketd example project
---
project/socketd/sock_client.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/project/socketd/client.c b/project/socketd/sock_client.c
similarity index 85%
rename from project/socketd/client.c
rename to project/socketd/sock_client.c
index e350bef..c9084cd 100644
--- a/project/socketd/client.c
+++ b/project/socketd/sock_client.c
@@ -46,9 +46,9 @@
int daemon = 1;
int opt;
char *progname=NULL;
- char *logfile="client.log";
- int loglevel=LOG_LEVEL_INFO;
- int logsize=10; /* logfile size max to 10K */
+ char *logfile="client.log";
+ int loglevel=LOG_LEVEL_INFO;
+ int logsize=10; /* logfile size max to 10K */
struct option long_options[] = {
{"debug", no_argument, NULL, 'd'},
@@ -66,8 +66,8 @@
{
case 'd': /* Set debug running */
daemon = 0;
- logfile="console";
- loglevel=LOG_LEVEL_DEBUG;
+ logfile="console";
+ loglevel=LOG_LEVEL_DEBUG;
break;
case 'v': /* Get software version */
@@ -84,11 +84,11 @@
}
- if( log_open(logfile, loglevel, logsize, THREAD_LOCK_NONE) < 0 )
- {
- fprintf(stderr, "Initial log system failed\n");
- return 1;
- }
+ if( log_open(logfile, loglevel, logsize, THREAD_LOCK_NONE) < 0 )
+ {
+ fprintf(stderr, "Initial log system failed\n");
+ return 1;
+ }
install_default_signal();
@@ -102,6 +102,7 @@
cleanup:
log_close();
+ unlink(DAEMON_PIDFILE);
return 0;
}
--
Gitblit v1.9.1