# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../clockspeed/0005-use-localstatedir.patch # Copyright (C) 2011 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- From c07880a1f68386eedfa63d114ebd785dd341ac6e Mon Sep 17 00:00:00 2001 From: Christian Wiese Date: Thu, 29 Sep 2011 14:29:52 +0200 Subject: [PATCH 5/6] change directory for adjust fifo, atto and leapsecs.dat file from /etc -> /var/state/clockspeed --- clockspeed.c | 12 ++++++------ hier.c | 5 +++-- leapsecs_read.c | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/clockspeed.c b/clockspeed.c index 18a7383..ec425bf 100644 --- a/clockspeed.c +++ b/clockspeed.c @@ -83,7 +83,7 @@ void savederiv() if (deriv <= 0) return; if (deriv > 200000000) return; /* 5Hz ticks? be serious */ - fd = open_trunc("etc/atto.tmp"); + fd = open_trunc("/var/state/clockspeed/atto.tmp"); if (fd == -1) return; buf[0] = 0; @@ -119,7 +119,7 @@ void savederiv() if (fsync(fd) == -1) { close(fd); return; } if (close(fd) == -1) return; /* NFS stupidity */ - rename("etc/atto.tmp","etc/atto"); /* if it fails, bummer */ + rename("/var/state/clockspeed/atto.tmp","/var/state/clockspeed/atto"); /* if it fails, bummer */ } void main() @@ -136,16 +136,16 @@ void main() if (chdir(auto_home) == -1) _exit(1); umask(033); - if (open_read("etc/atto") == 0) { + if (open_read("/var/state/clockspeed/atto") == 0) { r = read(0,buf,sizeof buf); if (r == sizeof buf) deriv = nano(buf); close(0); } - if (fifo_make("adjust",0600) == -1) if (errno != error_exist) _exit(1); - if (open_read("adjust") != 0) _exit(1); - if (open_write("adjust") == -1) _exit(1); + if (fifo_make("/var/state/clockspeed/adjust",0600) == -1) if (errno != error_exist) _exit(1); + if (open_read("/var/state/clockspeed/adjust") != 0) _exit(1); + if (open_write("/var/state/clockspeed/adjust") == -1) _exit(1); now(&first); diff --git a/hier.c b/hier.c index 3d66beb..5083582 100644 --- a/hier.c +++ b/hier.c @@ -2,11 +2,12 @@ void hier() { - c("/","etc","leapsecs.dat",-1,-1,0644); + d("/var/state","clockspeed",-1,-1,0755); + + c("/","var/state/clockspeed","leapsecs.dat",-1,-1,0644); h(auto_home,-1,-1,0755); - d(auto_home,"etc",-1,-1,0755); d(auto_home,"bin",-1,-1,0755); d(auto_home,"man",-1,-1,0755); d(auto_home,"man/man1",-1,-1,0755); diff --git a/leapsecs_read.c b/leapsecs_read.c index c8f975f..5266e60 100644 --- a/leapsecs_read.c +++ b/leapsecs_read.c @@ -17,7 +17,7 @@ int leapsecs_read() int i; struct tai u; - fd = open("/etc/leapsecs.dat",O_RDONLY | O_NDELAY); + fd = open("/var/state/clockspeed/leapsecs.dat",O_RDONLY | O_NDELAY); if (fd == -1) { if (errno != ENOENT) return -1; if (leapsecs) free(leapsecs); -- 1.6.6.2