From 59846b654e8b4a22a1be11cd21d6c5b81375abd2 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 6 Feb 2014 20:34:29 -0800 Subject: [PATCH] vold: fix errors inside ALOGV Fix errors exposed by adding compile-time checking to disabled ALOGVs. Change-Id: I29bd6e9a7648ccca02e0e9a96b79ee0ea7b5cfc6 --- Volume.cpp | 4 ++-- VolumeManager.cpp | 6 +++--- cryptfs.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Volume.cpp b/Volume.cpp index c290200..80552b6 100644 --- a/Volume.cpp +++ b/Volume.cpp @@ -378,14 +378,14 @@ int Volume::mountVol() { if (n != 1) { /* We only expect one device node returned when mounting encryptable volumes */ - SLOGE("Too many device nodes returned when mounting %d\n", getMountpoint()); + SLOGE("Too many device nodes returned when mounting %s\n", getMountpoint()); return -1; } if (cryptfs_setup_volume(getLabel(), MAJOR(deviceNodes[0]), MINOR(deviceNodes[0]), new_sys_path, sizeof(new_sys_path), &new_major, &new_minor)) { - SLOGE("Cannot setup encryption mapping for %d\n", getMountpoint()); + SLOGE("Cannot setup encryption mapping for %s\n", getMountpoint()); return -1; } /* We now have the new sysfs path for the decrypted block device, and the diff --git a/VolumeManager.cpp b/VolumeManager.cpp index 117eee0..19fb29a 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -91,7 +91,7 @@ char *VolumeManager::asecHash(const char *id, char *buffer, size_t len) { errno = ESPIPE; return NULL; } else if (len < MD5_ASCII_LENGTH_PLUS_NULL) { - SLOGE("Target hash buffer size < %d bytes (%d)", + SLOGE("Target hash buffer size < %d bytes (%zu)", MD5_ASCII_LENGTH_PLUS_NULL, len); errno = ESPIPE; return NULL; @@ -930,7 +930,7 @@ int VolumeManager::mountAsec(const char *id, const char *key, int ownerUid) { int written = snprintf(mountPoint, sizeof(mountPoint), "%s/%s", Volume::ASECDIR, id); if ((written < 0) || (size_t(written) >= sizeof(mountPoint))) { - SLOGE("ASEC mount failed: couldn't construct mountpoint", id); + SLOGE("ASEC mount failed for %s: couldn't construct mountpoint", id); return -1; } @@ -1077,7 +1077,7 @@ int VolumeManager::mountObb(const char *img, const char *key, int ownerGid) { int written = snprintf(mountPoint, sizeof(mountPoint), "%s/%s", Volume::LOOPDIR, idHash); if ((written < 0) || (size_t(written) >= sizeof(mountPoint))) { - SLOGE("OBB mount failed: couldn't construct mountpoint", img); + SLOGE("OBB mount failed for %s: couldn't construct mountpoint", img); return -1; } diff --git a/cryptfs.c b/cryptfs.c index 6247014..a742a63 100644 --- a/cryptfs.c +++ b/cryptfs.c @@ -276,7 +276,7 @@ static int put_crypt_ftr_and_key(struct crypt_mnt_ftr *crypt_ftr) /* If the keys are kept on a raw block device, do not try to truncate it. */ if (S_ISREG(statbuf.st_mode)) { if (ftruncate(fd, 0x4000)) { - SLOGE("Cannot set footer file size\n", fname); + SLOGE("Cannot set footer file size\n"); goto errout; } }