Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3368bdeb authored by George Burgess IV's avatar George Burgess IV Committed by android-build-merger
Browse files

Merge "Cleanup uses of sprintf so we can deprecate it."

am: 2c5b89a6

* commit '2c5b89a6':
  Cleanup uses of sprintf so we can deprecate it.
parents e6310fcb 2c5b89a6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -600,7 +600,7 @@ int fs_mgr_mount_all(struct fstab *fstab)
                  fstab->recs[top_idx].fs_type);
            if (fs_mgr_is_encryptable(&fstab->recs[top_idx]) &&
                strcmp(fstab->recs[top_idx].key_loc, KEY_IN_FOOTER)) {
                int fd = open(fstab->recs[top_idx].key_loc, O_WRONLY, 0644);
                int fd = open(fstab->recs[top_idx].key_loc, O_WRONLY);
                if (fd >= 0) {
                    INFO("%s(): also wipe %s\n", __func__, fstab->recs[top_idx].key_loc);
                    wipe_block_device(fd, get_file_size(fd));
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ static int format_ext4(char *fs_blkdev, char *fs_mnt_point)
    uint64_t dev_sz;
    int fd, rc = 0;

    if ((fd = open(fs_blkdev, O_WRONLY, 0644)) < 0) {
    if ((fd = open(fs_blkdev, O_WRONLY)) < 0) {
        ERROR("Cannot open block device.  %s\n", strerror(errno));
        return -1;
    }
+4 −4
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public:

    void store_sid(uint32_t uid, uint64_t sid) {
        char filename[21];
        sprintf(filename, "%u", uid);
        snprintf(filename, sizeof(filename), "%u", uid);
        int fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
        if (fd < 0) {
            ALOGE("could not open file: %s: %s", filename, strerror(errno));
@@ -102,7 +102,7 @@ public:

    void maybe_store_sid(uint32_t uid, uint64_t sid) {
        char filename[21];
        sprintf(filename, "%u", uid);
        snprintf(filename, sizeof(filename), "%u", uid);
        if (access(filename, F_OK) == -1) {
            store_sid(uid, sid);
        }
@@ -111,7 +111,7 @@ public:
    uint64_t read_sid(uint32_t uid) {
        char filename[21];
        uint64_t sid;
        sprintf(filename, "%u", uid);
        snprintf(filename, sizeof(filename), "%u", uid);
        int fd = open(filename, O_RDONLY);
        if (fd < 0) return 0;
        read(fd, &sid, sizeof(sid));
@@ -121,7 +121,7 @@ public:

    void clear_sid(uint32_t uid) {
        char filename[21];
        sprintf(filename, "%u", uid);
        snprintf(filename, sizeof(filename), "%u", uid);
        if (remove(filename) < 0) {
            ALOGE("%s: could not remove file [%s], attempting 0 write", __func__, strerror(errno));
            store_sid(uid, 0);
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ void parse_error(struct parse_state *state, const char *fmt, ...)
    char buf[128];
    int off;

    snprintf(buf, 128, "%s: %d: ", state->filename, state->line);
    snprintf(buf, sizeof(buf), "%s: %d: ", state->filename, state->line);
    buf[127] = 0;
    off = strlen(buf);

+2 −2
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused)))

        for (j = 0; j < 2; j++) {
            unsigned val = i + j * 3 + 1;
            sprintf(str, "test_fence%d-%d", i, j);
            snprintf(str, sizeof(str), "test_fence%d-%d", i, j);
            int fd = sw_sync_fence_create(sync_timeline_fd, str, val);
            if (fd < 0) {
                printf("can't create sync pt %d: %s", val, strerror(errno));
@@ -106,7 +106,7 @@ int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused)))

    sync_data[3].thread_no = 3;
    for (j = 0; j < 2; j++) {
        sprintf(str, "merged_fence%d", j);
        snprintf(str, sizeof(str), "merged_fence%d", j);
        sync_data[3].fd[j] = sync_merge(str, sync_data[0].fd[j], sync_data[1].fd[j]);
        if (sync_data[3].fd[j] < 0) {
            printf("can't merge sync pts %d and %d: %s\n",
Loading