]> git.pld-linux.org Git - packages/libldm.git/blob - libldm-warnings.patch
- new
[packages/libldm.git] / libldm-warnings.patch
1 --- libldm-0.2.3/src/Makefile.am.orig   2012-09-20 12:31:03.000000000 +0200
2 +++ libldm-0.2.3/src/Makefile.am        2013-01-07 19:20:40.782494058 +0100
3 @@ -15,7 +15,7 @@
4  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
5  
6  AM_CFLAGS = -Wall -Werror -Wshadow -Wextra \
7 -  -Wno-unused-local-typedefs \
8 +  -Wno-missing-field-initializers \
9    -Wno-unused-parameter
10  
11  libname = libldm-1.0.la
12 --- libldm-0.2.3/src/mbr.c.orig 2012-07-23 17:47:49.000000000 +0200
13 +++ libldm-0.2.3/src/mbr.c      2013-01-07 19:20:16.992494554 +0100
14 @@ -47,13 +47,13 @@
15  {
16      struct _mbr _mbr;
17  
18 -    size_t read = 0;
19 -    while (read < sizeof(_mbr)) {
20 -        ssize_t in = pread(fd, &_mbr + read, sizeof(struct _mbr) - read, read);
21 +    size_t nread = 0;
22 +    while (nread < sizeof(_mbr)) {
23 +        ssize_t in = pread(fd, &_mbr + nread, sizeof(struct _mbr) - nread, nread);
24          if (in == 0) return -MBR_ERROR_INVALID;
25          if (in == -1) return -MBR_ERROR_READ;
26  
27 -        read += in;
28 +        nread += in;
29      }
30  
31      if (_mbr.magic[0] != 0x55 || _mbr.magic[1] != 0xAA)
32 --- libldm-0.2.3/src/gpt.c.orig 2012-09-20 12:31:03.000000000 +0200
33 +++ libldm-0.2.3/src/gpt.c      2013-01-07 19:29:04.812483553 +0100
34 @@ -82,14 +82,14 @@
35      const off_t gpt_start = secsize;
36  
37      struct _gpt_head head;
38 -    size_t read = 0;
39 -    while (read < sizeof(head)) {
40 -        ssize_t in = pread(fd, &head + read, sizeof(head) - read,
41 -                           read + gpt_start);
42 +    size_t nread = 0;
43 +    while (nread < sizeof(head)) {
44 +        ssize_t in = pread(fd, &head + nread, sizeof(head) - nread,
45 +                           nread + gpt_start);
46          if (in == 0) return -GPT_ERROR_INVALID;
47          if (in == -1) return -GPT_ERROR_READ;
48  
49 -        read += in;
50 +        nread += in;
51      }
52  
53      if (memcmp(head.magic, "EFI PART", 8) != 0) return -GPT_ERROR_INVALID;
54 @@ -111,9 +111,9 @@
55  
56      struct _gpt *_gpt = (*h)->gpt;
57      memcpy(_gpt, &head, sizeof(head));
58 -    while (read < le32toh(head.size)) {
59 -        ssize_t in = pread(fd, (char *)(_gpt) + read, le32toh(head.size) - read,
60 -                           read + gpt_start);
61 +    while (nread < le32toh(head.size)) {
62 +        ssize_t in = pread(fd, (char *)(_gpt) + nread, le32toh(head.size) - nread,
63 +                           nread + gpt_start);
64          if (in == 0) {
65              err = -GPT_ERROR_INVALID;
66              goto error;
67 @@ -123,7 +123,7 @@
68              goto error;
69          }
70  
71 -        read += in;
72 +        nread += in;
73      }
74  
75      uint32_t header_crc = _gpt->header_crc;
76 @@ -151,10 +151,10 @@
77      if ((*h)->pte_array == NULL) abort();
78  
79      const off_t pte_array_start = _gpt->pte_array_start_lba * secsize;
80 -    read = 0;
81 -    while (read < pte_array_size) {
82 -        ssize_t in = pread(fd, (*h)->pte_array + read, pte_array_size - read,
83 -                           read + pte_array_start);
84 +    nread = 0;
85 +    while (nread < pte_array_size) {
86 +        ssize_t in = pread(fd, (*h)->pte_array + nread, pte_array_size - nread,
87 +                           nread + pte_array_start);
88          if (in == 0) {
89              err = -GPT_ERROR_INVALID;
90              goto error;
91 @@ -164,7 +164,7 @@
92              goto error;
93          }
94  
95 -        read += in;
96 +        nread += in;
97      }
98  
99      crc = crc32(0L, Z_NULL, 0);
100 --- libldm-0.2.3/src/ldm.c.orig 2012-09-21 12:21:17.000000000 +0200
101 +++ libldm-0.2.3/src/ldm.c      2013-01-07 19:31:35.259147085 +0100
102 @@ -1170,15 +1170,15 @@
103               void ** const config, GError ** const err)
104  {
105      /* Sanity check ldm_config_start and ldm_config_size */
106 -    struct stat stat;
107 -    if (fstat(fd, &stat) == -1) {
108 +    struct stat sstat;
109 +    if (fstat(fd, &sstat) == -1) {
110          g_set_error(err, LDM_ERROR, LDM_ERROR_IO,
111                      "Unable to stat %s: %m", path);
112          return FALSE;
113      }
114  
115 -    uint64_t size = stat.st_size;
116 -    if (S_ISBLK(stat.st_mode)) {
117 +    uint64_t size = sstat.st_size;
118 +    if (S_ISBLK(sstat.st_mode)) {
119          if (ioctl(fd, BLKGETSIZE64, &size) == -1) {
120              g_set_error(err, LDM_ERROR, LDM_ERROR_IO,
121                          "Unable to get block device size for %s: %m", path);
122 @@ -1205,10 +1205,10 @@
123      }
124  
125      *config = g_malloc(config_size);
126 -    size_t read = 0;
127 -    while (read < config_size) {
128 -        ssize_t in = pread(fd, *config + read, config_size - read,
129 -                           config_start + read);
130 +    size_t nread = 0;
131 +    while (nread < config_size) {
132 +        ssize_t in = pread(fd, *config + nread, config_size - nread,
133 +                           config_start + nread);
134          if (in == 0) {
135              g_set_error(err, LDM_ERROR, LDM_ERROR_INVALID,
136                          "%s contains invalid LDM metadata", path);
137 @@ -1221,7 +1221,7 @@
138              goto error;
139          }
140  
141 -        read += in;
142 +        nread += in;
143      }
144  
145      return TRUE;
146 @@ -1236,11 +1236,11 @@
147                     const uint64_t ph_start,
148                     struct _privhead * const privhead, GError **err)
149  {
150 -    size_t read = 0;
151 -    while (read < sizeof(*privhead)) {
152 -        ssize_t in = pread(fd, (char *) privhead + read,
153 -                           sizeof(*privhead) - read,
154 -                           ph_start + read);
155 +    size_t nread = 0;
156 +    while (nread < sizeof(*privhead)) {
157 +        ssize_t in = pread(fd, (char *) privhead + nread,
158 +                           sizeof(*privhead) - nread,
159 +                           ph_start + nread);
160          if (in == 0) {
161              g_set_error(err, LDM_ERROR, LDM_ERROR_INVALID,
162                          "%s contains invalid LDM metadata", path);
163 @@ -1253,7 +1253,7 @@
164              return FALSE;
165          }
166  
167 -        read += in;
168 +        nread += in;
169      }
170  
171      if (memcmp(privhead->magic, "PRIVHEAD", 8) != 0) {
This page took 0.11399 seconds and 3 git commands to generate.