[klibc] [klibc:master] ipconfig: Use /run/ directory for script file

klibc-bot for maximilian attems max at stro.at
Tue May 22 02:12:02 PDT 2012


Commit-ID:  db9f464c660023eac861d661840fcef6809db163
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=db9f464c660023eac861d661840fcef6809db163
Author:     maximilian attems <max at stro.at>
AuthorDate: Tue, 22 May 2012 11:04:42 +0200
Committer:  maximilian attems <max at stro.at>
CommitDate: Tue, 22 May 2012 11:04:42 +0200

[klibc] ipconfig: Use /run/ directory for script file

This could be made to be an optional switch,
but for security reason /run is just as good, due to unprivileged
users not beeing allowed to write there.

http://www.zytor.com/pipermail/klibc/2011-May/002912.html

Reported-by: Dan Rosenberg <dan.j.rosenberg at gmail.com>
Signed-off-by: maximilian attems <max at stro.at>

---
 usr/kinit/ipconfig/main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c
index 476384a..7be2a1f 100644
--- a/usr/kinit/ipconfig/main.c
+++ b/usr/kinit/ipconfig/main.c
@@ -147,8 +147,9 @@ static void dump_device_config(struct netdev *dev)
 	 * sizeof(UINT64_MAX)==21
 	 */
 	char buf21[21];
+	const char path[] = "/run/";
 
-	snprintf(fn, sizeof(fn), "/tmp/net-%s.conf", dev->name);
+	snprintf(fn, sizeof(fn), "%snet-%s.conf", path, dev->name);
 	f = fopen(fn, "w");
 	if (f) {
 		write_option(f, "DEVICE", dev->name);


More information about the klibc mailing list