~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to src/libecryptfs/ecryptfs-stat.c

  • Committer: Dustin Kirkland
  • Date: 2009-02-03 08:18:53 UTC
  • Revision ID: git-v1:b0090ac8d4f626339d7f8ca5681934d5e68dac3e
make most of the code compatible with -Werror

Thanks to Michal Hlavinka for the patch.  This has been on my
to-do list for a while now!

Patch retrieved from:
https://bugzilla.redhat.com/show_bug.cgi?id=479762

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <unistd.h>
 
2
#include <stdlib.h>
2
3
#include <stdint.h>
3
4
#include <string.h>
4
5
#include <errno.h>
17
18
 
18
19
static int host_is_big_endian(void)
19
20
{
20
 
        int i;
21
21
        uint32_t tmp_u32;
22
22
        char tmp_str[sizeof(uint32_t)];
23
23
 
129
129
            && (crypt_stat->num_header_bytes_at_front
130
130
                < ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE)) {
131
131
                rc = -EINVAL;
132
 
                printf("%s Invalid header size: [%d]\n", __FUNCTION__,
 
132
                printf("%s Invalid header size: [%zu]\n", __FUNCTION__,
133
133
                       crypt_stat->num_header_bytes_at_front);
134
134
        }
135
135
        return rc;
183
183
        size_t packet_size;
184
184
        struct ecryptfs_auth_tok *new_auth_tok;
185
185
        unsigned char sig_tmp_space[ECRYPTFS_SIG_SIZE];
186
 
        size_t tag_11_contents_size;
 
186
        size_t tag_11_contents_size = 0;
187
187
        size_t tag_11_packet_size;
188
188
        int next_packet_is_auth_tok_packet = 1;
189
189
        int rc = 0;
227
227
                        if (ECRYPTFS_SIG_SIZE != tag_11_contents_size) {
228
228
                                printf("%s: Expected "
229
229
                                       "signature of size [%d]; "
230
 
                                       "read size [%d]\n", __FUNCTION__,
 
230
                                       "read size [%zu]\n", __FUNCTION__,
231
231
                                       ECRYPTFS_SIG_SIZE,
232
232
                                       tag_11_contents_size);
233
233
                                rc = -EINVAL;
234
234
                                goto out_wipe_list;
235
235
                        }
236
 
                        ecryptfs_to_hex(new_auth_tok->token.password.signature,
237
 
                                        sig_tmp_space, tag_11_contents_size);
 
236
                        ecryptfs_to_hex((char *)new_auth_tok->token.password.signature,
 
237
                                        (char *)sig_tmp_space, tag_11_contents_size);
238
238
                        new_auth_tok->token.password.signature[
239
239
                                ECRYPTFS_PASSWORD_SIG_SIZE] = '\0';
240
240
                        break;
261
261
                        break;
262
262
                default:
263
263
                        printf("%s: No packet at offset "
264
 
                               "[%d] of the file header; hex value of "
 
264
                               "[%zu] of the file header; hex value of "
265
265
                               "character is [0x%.2x]\n", __FUNCTION__, i,
266
266
                               src[i]);
267
267
                        next_packet_is_auth_tok_packet = 0;
300
300
        if (buf_size < (ECRYPTFS_FILE_SIZE_BYTES
301
301
                        + MAGIC_ECRYPTFS_MARKER_SIZE_BYTES
302
302
                        + 4)) {
303
 
                printf("%s: Invalid metadata size; must have at least [%d] "
304
 
                       "bytes; there are only [%d] bytes\n", __FUNCTION__,
 
303
                printf("%s: Invalid metadata size; must have at least [%lu] "
 
304
                       "bytes; there are only [%zu] bytes\n", __FUNCTION__,
305
305
                       (ECRYPTFS_FILE_SIZE_BYTES
306
306
                        + MAGIC_ECRYPTFS_MARKER_SIZE_BYTES
307
307
                        + 4), buf_size);