From f4020e76222999793c915cc7f5f477debb39e0cc Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Sun, 8 Dec 2024 09:26:37 +0800 Subject: [PATCH] remove compile warning under some gcc versions --- make.sh | 1 + src/process_ctrl.c | 6 +++--- src/shared_func.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/make.sh b/make.sh index a4318c7..0fe7bed 100755 --- a/make.sh +++ b/make.sh @@ -250,6 +250,7 @@ sed_replace() cd src cp Makefile.in Makefile +sed_replace "s#\\\$(CC)#gcc#g" Makefile sed_replace "s#\\\$(CFLAGS)#$CFLAGS#g" Makefile sed_replace "s#\\\$(INCS)#$INCS#g" Makefile sed_replace "s#\\\$(LIBS)#$LIBS#g" Makefile diff --git a/src/process_ctrl.c b/src/process_ctrl.c index c146e7e..4b47169 100644 --- a/src/process_ctrl.c +++ b/src/process_ctrl.c @@ -57,7 +57,7 @@ int write_to_pid_file(const char *pidFilename) int delete_pid_file(const char *pidFilename) { int result; - pid_t pid; + pid_t pid = 0; if ((result=get_pid_from_file(pidFilename, &pid)) != 0) { return result; @@ -115,7 +115,7 @@ static int do_stop(const char *pidFilename, const bool bShowError, pid_t *pid) int process_stop_ex(const char *pidFilename, const bool bShowError) { #define MAX_WAIT_COUNT 300 - pid_t pid; + pid_t pid = 0; int result; int sig; int i; @@ -192,7 +192,7 @@ static const char *get_exename_by_pid(const pid_t pid, char *buff, int process_start(const char* pidFilename) { - pid_t pid; + pid_t pid = 0; int result; if ((result=get_pid_from_file(pidFilename, &pid)) != 0) { diff --git a/src/shared_func.c b/src/shared_func.c index 9d47a65..73bc3ec 100644 --- a/src/shared_func.c +++ b/src/shared_func.c @@ -3983,7 +3983,7 @@ int fc_get_last_line(const char *filename, char *buff, int fc_get_last_lines(const char *filename, char *buff, const int buff_size, string_t *lines, int *count) { - int64_t file_size; + int64_t file_size = 0; int64_t offset; int64_t read_bytes; int remain_len;