From patchwork Fri May 9 15:44:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Renninger X-Patchwork-Id: 888988 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29087230BC0 for ; Fri, 9 May 2025 15:45:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746805520; cv=none; b=BL3Lm4vV7iWk7ngupW+JcLDDuEIC/SgtPG72HhuAUqLZGzYYHUX6hVO9NSnEmDYh7d0kp3R7vIEXuMruhdk4zAUqpYsUIgOY42vrfdaCyxWa3mJRQnAo8W9mTPsflqzvYjB7dBsu+n84iMlqntbUS5+St+lC8+vdgBPMEbfHHs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746805520; c=relaxed/simple; bh=nWCm9mXvOaYOxBrXOcTo0OKjloCFgkNAkI80nYWx7Pk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j54Jak1tRSA4dZPKQjo8pK2r0jS0Qx/F6zQS4xelEqfjlUJErCS/nZPo4CXKhptBCJ3pjL8BNWzUygO2lydtgVo4Vxt3PwDI7Z3Muy68yLGROK2+ZUvwcR4nw08oU2Y7R+pQiO6H+QEo1wHYgrv0cg7kYYmqUGP0Lqp/gvxlqEY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=h/kbTYhv; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=a+LD4VtT; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=h/kbTYhv; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=a+LD4VtT; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="h/kbTYhv"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="a+LD4VtT"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="h/kbTYhv"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="a+LD4VtT" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 368D01F38A; Fri, 9 May 2025 15:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1746805515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=inyGEKlGnY/hETdv9Kc987kps+mkaKJrtc3EX5u9b1c=; b=h/kbTYhvquG322nHWc03PnBVDZMPYd2VchxOdJOr/VhVEX7pstg9iwTnbIwkNLtPsJHefY smNPCEWUHRITWX8x1clZ+SkOTB9lwlNd3fK+ZwwdWGijsh8/M8LPzAWmc2SCM1OOMVvFct BvFPOfO2QkR6DO2PZHzjlCt9wKbcVbo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1746805515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=inyGEKlGnY/hETdv9Kc987kps+mkaKJrtc3EX5u9b1c=; b=a+LD4VtTcXoVUmUEnJ3DyH9u5lMoV8oWoo104FwCoC0cC9k1gYnk8APQnubgw1iyVIG9VU tzlS9+hHj12eEdCw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="h/kbTYhv"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=a+LD4VtT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1746805515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=inyGEKlGnY/hETdv9Kc987kps+mkaKJrtc3EX5u9b1c=; b=h/kbTYhvquG322nHWc03PnBVDZMPYd2VchxOdJOr/VhVEX7pstg9iwTnbIwkNLtPsJHefY smNPCEWUHRITWX8x1clZ+SkOTB9lwlNd3fK+ZwwdWGijsh8/M8LPzAWmc2SCM1OOMVvFct BvFPOfO2QkR6DO2PZHzjlCt9wKbcVbo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1746805515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=inyGEKlGnY/hETdv9Kc987kps+mkaKJrtc3EX5u9b1c=; b=a+LD4VtTcXoVUmUEnJ3DyH9u5lMoV8oWoo104FwCoC0cC9k1gYnk8APQnubgw1iyVIG9VU tzlS9+hHj12eEdCw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 012F7139D0; Fri, 9 May 2025 15:45:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id YHHBOgojHmgrYwAAD6G6ig (envelope-from ); Fri, 09 May 2025 15:45:14 +0000 From: Thomas Renninger To: linux-pm@vger.kernel.org Cc: Jacob Pan , Zhang Rui , mmayer@broadcom.com, Wolfgang Frisch , Neil Horman , Thomas Renninger Subject: [PATCH 1/3] tools/thermal/tmon: Prevent symlink attack on log file Date: Fri, 9 May 2025 17:44:33 +0200 Message-ID: <20250509154435.14670-2-trenn@suse.de> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250509154435.14670-1-trenn@suse.de> References: <20250509154435.14670-1-trenn@suse.de> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Queue-Id: 368D01F38A X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,suse.de:email,suse.de:mid,suse.de:dkim]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_SEVEN(0.00)[7]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 From: Wolfgang Frisch If fs.protected_symlinks=0, an unprivileged local user could create a symbolic link at /var/log/tmon.log and, in turn, cause `tmon -l` to truncate arbitrary files on the system when prepare_logging() is executed. Change prepare_logging() to use openat() and create the log file securely. Fixes: 951fda3d8c644597a1d5cdae14cab31567e754a1 Signed-off-by: Wolfgang Frisch Reviewed-by: Thomas Renninger --- tools/thermal/tmon/tmon.c | 50 +++++++++++++++++++++++++++------------ tools/thermal/tmon/tmon.h | 3 ++- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/tools/thermal/tmon/tmon.c b/tools/thermal/tmon/tmon.c index 7eb3216a27f4..e7392c0f6388 100644 --- a/tools/thermal/tmon/tmon.c +++ b/tools/thermal/tmon/tmon.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include "tmon.h" @@ -132,35 +134,53 @@ static void prepare_logging(void) { int i; struct stat logstat; + int dir_fd = -1; + int log_fd = -1; + tmon_log = NULL; if (!logging) return; - /* open local data log file */ - tmon_log = fopen(TMON_LOG_FILE, "w+"); - if (!tmon_log) { - syslog(LOG_ERR, "failed to open log file %s\n", TMON_LOG_FILE); + + /* get a file descriptor for the log directory */ + dir_fd = open(TMON_LOG_DIR, O_RDONLY | O_DIRECTORY | O_CLOEXEC); + if (dir_fd < 0) { + syslog(LOG_ERR, "Failed to open log directory %s: %s\n", + TMON_LOG_DIR, strerror(errno)); return; } - if (lstat(TMON_LOG_FILE, &logstat) < 0) { - syslog(LOG_ERR, "Unable to stat log file %s\n", TMON_LOG_FILE); - fclose(tmon_log); - tmon_log = NULL; + /* open local data log file securely using openat() */ + log_fd = openat(dir_fd, TMON_LOG_FILENAME, + O_RDWR | O_CREAT | O_TRUNC | O_NOFOLLOW | O_CLOEXEC, + 0600); + close(dir_fd); + + if (log_fd < 0) { + syslog(LOG_ERR, "Failed to open log file %s/%s: %s\n", + TMON_LOG_DIR, TMON_LOG_FILENAME, strerror(errno)); return; } - /* The log file must be a regular file owned by us */ - if (S_ISLNK(logstat.st_mode)) { - syslog(LOG_ERR, "Log file is a symlink. Will not log\n"); - fclose(tmon_log); - tmon_log = NULL; + if (fstat(log_fd, &logstat) < 0) { + syslog(LOG_ERR, "Unable to stat log file %s/%s\n", + TMON_LOG_DIR, TMON_LOG_FILENAME); + close(log_fd); return; } + /* The log file must be owned by us */ if (logstat.st_uid != getuid()) { syslog(LOG_ERR, "We don't own the log file. Not logging\n"); - fclose(tmon_log); - tmon_log = NULL; + close(log_fd); + return; + } + + /* All checks passed. Convert the file descriptor to a FILE stream. */ + tmon_log = fdopen(log_fd, "w+"); + if (!tmon_log) { + syslog(LOG_ERR, "Failed to fdopen log file descriptor for %s/%s: %s\n", + TMON_LOG_DIR, TMON_LOG_FILENAME, strerror(errno)); + close(log_fd); return; } diff --git a/tools/thermal/tmon/tmon.h b/tools/thermal/tmon/tmon.h index 44d16d778f04..5c35f8cd7cab 100644 --- a/tools/thermal/tmon/tmon.h +++ b/tools/thermal/tmon/tmon.h @@ -25,7 +25,8 @@ */ #define DATA_LEFT_ALIGN 10 #define NR_LINES_TZDATA 1 -#define TMON_LOG_FILE "/var/tmp/tmon.log" +#define TMON_LOG_DIR "/var/tmp" +#define TMON_LOG_FILENAME "tmon.log" #include #include From patchwork Fri May 9 15:44:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Renninger X-Patchwork-Id: 888987 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 205C522D9EA for ; Fri, 9 May 2025 15:45:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746805531; cv=none; b=qJ2zf5OnlwXYcKmjaY9blxePXWFeCf67AhA9DJjjsv47XDV+LRZ08GsWdHppTAyiiMJUeLJuX7LDliQxtjns4vrZK3coqoUo/T7d62C1q7+wxAWMZKixUHa3jBduOQVzfDioybGl23bT898RJY3r0yjJxhNGiZAlyIhhjGiyFS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746805531; c=relaxed/simple; bh=JX4b3O3HClIl8xFemtm8sMW5FD47aYIkuMJ7qN29tkY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eFDGYUBvvmDptlYMmjjyJSfLprd7vpWRz7XBMBFkb7aheSon9K3CGbtG8IL97kHeDehnNTMlmQkzHfVnUisWW6EmjzZtiqJn6fhQpqBfMDjJrOq+qJsRcEa8VMcpwD0bm0+KNrk4K/6JKBsWTcfnKMICCzAgt87fgRB3cznOLjc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=cFo+ZIax; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=6PUT0UbI; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=cFo+ZIax; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=6PUT0UbI; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="cFo+ZIax"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="6PUT0UbI"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="cFo+ZIax"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="6PUT0UbI" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B0F492116D; Fri, 9 May 2025 15:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1746805515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZZhL/RJQhO2eG+Sr8jM5jZDRgKoZyxBFdqW1I47ib3Q=; b=cFo+ZIaxshzc38b2z3QEWI6oT3GH2syveYRjNnxe0dreQdHV8/vNMlMQa32JTalWwyM7OT Ck9/4DlfRbzAqOfKVPJ5LbFRSaKcztmNmVf5eoRshmOpqFBpe77tNIAtDJnf/zBvIrPjM1 F5RsmkXyA9UWOArEAXqeAEhX4t6mJHY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1746805515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZZhL/RJQhO2eG+Sr8jM5jZDRgKoZyxBFdqW1I47ib3Q=; b=6PUT0UbIXT8bolYKMHmvgGz6wKibky7TYayOOS6IdWYbaBRV2hBeZR/yUgTePG7nzISkYy f0xxUuhwNuYTr6CA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1746805515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZZhL/RJQhO2eG+Sr8jM5jZDRgKoZyxBFdqW1I47ib3Q=; b=cFo+ZIaxshzc38b2z3QEWI6oT3GH2syveYRjNnxe0dreQdHV8/vNMlMQa32JTalWwyM7OT Ck9/4DlfRbzAqOfKVPJ5LbFRSaKcztmNmVf5eoRshmOpqFBpe77tNIAtDJnf/zBvIrPjM1 F5RsmkXyA9UWOArEAXqeAEhX4t6mJHY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1746805515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZZhL/RJQhO2eG+Sr8jM5jZDRgKoZyxBFdqW1I47ib3Q=; b=6PUT0UbIXT8bolYKMHmvgGz6wKibky7TYayOOS6IdWYbaBRV2hBeZR/yUgTePG7nzISkYy f0xxUuhwNuYTr6CA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7C58E1399F; Fri, 9 May 2025 15:45:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id CMo4HQsjHmgrYwAAD6G6ig (envelope-from ); Fri, 09 May 2025 15:45:15 +0000 From: Thomas Renninger To: linux-pm@vger.kernel.org Cc: Jacob Pan , Zhang Rui , mmayer@broadcom.com, Wolfgang Frisch , Neil Horman , Thomas Renninger , Thomas Renninger Subject: [PATCH 3/3] tools/thermal/tmon: Cleanup only: Use LOG_FILE vars Date: Fri, 9 May 2025 17:44:35 +0200 Message-ID: <20250509154435.14670-4-trenn@suse.de> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250509154435.14670-1-trenn@suse.de> References: <20250509154435.14670-1-trenn@suse.de> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-2.75 / 50.00]; BAYES_HAM(-2.95)[99.78%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,suse.de:mid]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.75 Signed-off-by: Thomas Renninger --- tools/thermal/tmon/tmon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/thermal/tmon/tmon.c b/tools/thermal/tmon/tmon.c index f803f2a2fb12..e441b165035f 100644 --- a/tools/thermal/tmon/tmon.c +++ b/tools/thermal/tmon/tmon.c @@ -55,7 +55,8 @@ void usage(void) printf(" -d, --daemon run as daemon, no TUI\n"); printf(" -g, --debug debug message in syslog\n"); printf(" -h, --help show this help message\n"); - printf(" -l, --log log data to /var/tmp/tmon.log\n"); + printf(" -l, --log log data to %s/%s\n", + TMON_LOG_DIR, TMON_LOG_FILENAME); printf(" -t, --time-interval sampling time interval, > 1 sec.\n"); printf(" -T, --target-temp initial target temperature\n"); printf(" -v, --version show version\n"); @@ -271,7 +272,8 @@ int main(int argc, char **argv) target_temp_user = temp; break; case 'l': - printf("Logging data to /var/tmp/tmon.log\n"); + printf("Logging data to %s/%s\n", + TMON_LOG_DIR, TMON_LOG_FILENAME); logging = 1; break; case 'h':