Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 308687 Details for
Bug 411785
app-misc/uptimed loses its database
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch from Debian Sid - bootid file is not needed on linux
no-bootid-file-on-linux.patch (text/plain), 2.37 KB, created by
jjtt
on 2012-04-12 18:43:27 UTC
(
hide
)
Description:
patch from Debian Sid - bootid file is not needed on linux
Filename:
MIME Type:
Creator:
jjtt
Created:
2012-04-12 18:43:27 UTC
Size:
2.37 KB
patch
obsolete
>diff -uriNp uptimed-0.3.16/libuptimed/urec.c uptimed-0.3.16-nobootidfile//libuptimed/urec.c >--- uptimed-0.3.16/libuptimed/urec.c 2009-01-02 00:46:00.000000000 +0100 >+++ uptimed-0.3.16-nobootidfile//libuptimed/urec.c 2011-08-26 16:53:58.000000000 +0200 >@@ -268,34 +268,11 @@ void save_records(int max, time_t log_th > rename(FILE_RECORDS".tmp", FILE_RECORDS); > } > >-#ifdef PLATFORM_LINUX >+#if defined(PLATFORM_LINUX) || defined(PLATFORM_BSD) > int createbootid(void) { >- FILE *f; >- char str[256]; >- time_t bootid = 0; >- >- f=fopen("/proc/stat", "r"); >- if (!f) { >- printf ("Error opening /proc file. Can not determine bootid, exiting!\n"); exit(-1); >- } else { >- fgets(str, sizeof(str), f); >- while (!feof(f)) { >- if (strstr(str, "btime")) { >- bootid=atoi(str+6); >- break; >- } >- fgets(str, sizeof(str), f); >- } >- fclose(f); >- } >- >- f = fopen(FILE_BOOTID, "w"); >- if (!f) { >- printf("Error writing bootid file, exiting!\n"); exit(-1); >- } else { >- fprintf(f, "%ld\n", bootid); >- fclose(f); >- } >+ /* these platforms doesn't need to create a bootid file. >+ * readbootid() fetches it directly from the system every time. >+ */ > return 0; > } > #endif >@@ -384,6 +361,31 @@ time_t readbootid(void) { > } > > return bootid; >+#elif PLATFORM_LINUX >+ FILE *f; >+ char str[256]; >+ time_t bootid = 0; >+ >+ f=fopen("/proc/stat", "r"); >+ if (!f) { >+ printf ("Error opening /proc/stat file. Can not determine bootid, exiting!\n"); >+ exit(-1); >+ } else { >+ fgets(str, sizeof(str), f); >+ while (!feof(f)) { >+ if (strstr(str, "btime")) { >+ bootid=atoi(str+6); >+ break; >+ } >+ fgets(str, sizeof(str), f); >+ } >+ fclose(f); >+ } >+ if (bootid == 0) { >+ printf ("Parsing btime from /proc/stat failed. Can not determine bootid, exiting!\n"); >+ exit(-1); >+ } >+ return bootid; > #else > FILE *f; > char str[256]; >diff -uriNp uptimed-0.3.16/src/uptimed.c uptimed-0.3.16-nobootidfile//src/uptimed.c >--- uptimed-0.3.16/src/uptimed.c 2009-01-02 00:46:00.000000000 +0100 >+++ uptimed-0.3.16-nobootidfile//src/uptimed.c 2011-08-26 16:48:00.000000000 +0200 >@@ -75,7 +75,6 @@ int main(int argc, char *argv[]) > } > } > >-#ifndef PLATFORM_BSD > /* Create bootid and exit. Should be done once on startup. */ > if (create_bootid) > { >@@ -83,7 +82,6 @@ int main(int argc, char *argv[]) > syslog(LOG_INFO, SYSLOG_PREFIX "created bootid: %d", readbootid()); > exit(0); > } >-#endif > > if (update_interval<1) > update_interval=1;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 411785
:
308681
| 308687 |
308689