diff options
Diffstat (limited to 'meta-systemd/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch')
-rw-r--r-- | meta-systemd/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/meta-systemd/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch b/meta-systemd/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch deleted file mode 100644 index 089ba6469..000000000 --- a/meta-systemd/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | Index: git/src/journal/journal-file.c | ||
2 | =================================================================== | ||
3 | --- git.orig/src/journal/journal-file.c 2012-09-02 09:49:15.126089594 -0700 | ||
4 | +++ git/src/journal/journal-file.c 2012-09-02 09:49:17.118089670 -0700 | ||
5 | @@ -34,6 +34,8 @@ | ||
6 | #include "compress.h" | ||
7 | #include "fsprg.h" | ||
8 | |||
9 | +#include "config.h" | ||
10 | + | ||
11 | #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem)) | ||
12 | #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem)) | ||
13 | |||
14 | @@ -262,7 +264,7 @@ | ||
15 | |||
16 | static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) { | ||
17 | uint64_t old_size, new_size; | ||
18 | - int r; | ||
19 | + int r = 0; | ||
20 | |||
21 | assert(f); | ||
22 | |||
23 | @@ -307,10 +309,25 @@ | ||
24 | /* Note that the glibc fallocate() fallback is very | ||
25 | inefficient, hence we try to minimize the allocation area | ||
26 | as we can. */ | ||
27 | +#ifdef HAVE_POSIX_ALLOCATE | ||
28 | r = posix_fallocate(f->fd, old_size, new_size - old_size); | ||
29 | if (r != 0) | ||
30 | return -r; | ||
31 | |||
32 | +#else | ||
33 | + /* Use good old method to write zeros into the journal file | ||
34 | + perhaps very inefficient yet working. */ | ||
35 | + if(new_size > old_size) { | ||
36 | + char *buf = alloca(new_size - old_size); | ||
37 | + off_t oldpos = lseek(f->fd, 0, SEEK_CUR); | ||
38 | + bzero(buf, new_size - old_size); | ||
39 | + lseek(f->fd, old_size, SEEK_SET); | ||
40 | + r = write(f->fd, buf, new_size - old_size); | ||
41 | + lseek(f->fd, oldpos, SEEK_SET); | ||
42 | + } | ||
43 | + if (r < 0) | ||
44 | + return -errno; | ||
45 | +#endif /* HAVE_POSIX_FALLOCATE */ | ||
46 | if (fstat(f->fd, &f->last_stat) < 0) | ||
47 | return -errno; | ||
48 | |||
49 | Index: git/src/journal/journald-kmsg.c | ||
50 | =================================================================== | ||
51 | --- git.orig/src/journal/journald-kmsg.c 2012-09-02 09:49:15.130089595 -0700 | ||
52 | +++ git/src/journal/journald-kmsg.c 2012-09-02 12:26:17.326447895 -0700 | ||
53 | @@ -404,6 +404,7 @@ | ||
54 | |||
55 | int server_open_kernel_seqnum(Server *s) { | ||
56 | int fd; | ||
57 | + int r = 0; | ||
58 | uint64_t *p; | ||
59 | |||
60 | assert(s); | ||
61 | @@ -417,8 +418,19 @@ | ||
62 | log_error("Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m"); | ||
63 | return 0; | ||
64 | } | ||
65 | - | ||
66 | - if (posix_fallocate(fd, 0, sizeof(uint64_t)) < 0) { | ||
67 | +#ifdef HAVE_POSIX_ALLOCATE | ||
68 | + r = posix_fallocate(fd, 0, sizeof(uint64_t)); | ||
69 | +#else | ||
70 | + /* Use good old method to write zeros into the journal file | ||
71 | + perhaps very inefficient yet working. */ | ||
72 | + char *buf = alloca(sizeof(uint64_t)); | ||
73 | + off_t oldpos = lseek(fd, 0, SEEK_CUR); | ||
74 | + bzero(buf, sizeof(uint64_t)); | ||
75 | + lseek(fd, 0, SEEK_SET); | ||
76 | + r = write(fd, buf, sizeof(uint64_t)); | ||
77 | + lseek(fd, oldpos, SEEK_SET); | ||
78 | +#endif /* HAVE_POSIX_FALLOCATE */ | ||
79 | + if (r < 0) { | ||
80 | log_error("Failed to allocate sequential number file, ignoring: %m"); | ||
81 | close_nointr_nofail(fd); | ||
82 | return 0; | ||