Fix nullpointer when recovery.fstab does not define a "misc" partition
Change-Id: I57437e3c637a1c619d254a3fc025db19ffe53c10
This commit is contained in:
		
							
								
								
									
										30
									
								
								bootloader.c
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								bootloader.c
									
									
									
									
									
								
							@@ -30,23 +30,33 @@ static int set_bootloader_message_block(const struct bootloader_message *in, con
 | 
			
		||||
 | 
			
		||||
int get_bootloader_message(struct bootloader_message *out) {
 | 
			
		||||
    Volume* v = volume_for_path("/misc");
 | 
			
		||||
    if (strcmp(v->fs_type, "mtd") == 0) {
 | 
			
		||||
        return get_bootloader_message_mtd(out, v);
 | 
			
		||||
    } else if (strcmp(v->fs_type, "emmc") == 0) {
 | 
			
		||||
        return get_bootloader_message_block(out, v);
 | 
			
		||||
    if(v)
 | 
			
		||||
    {
 | 
			
		||||
        if (strcmp(v->fs_type, "mtd") == 0) {
 | 
			
		||||
                return get_bootloader_message_mtd(out, v);
 | 
			
		||||
        } else if (strcmp(v->fs_type, "emmc") == 0) {
 | 
			
		||||
                return get_bootloader_message_block(out, v);
 | 
			
		||||
        }
 | 
			
		||||
        LOGE("unknown misc partition fs_type \"%s\"\n", v->fs_type);
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
    LOGE("unknown misc partition fs_type \"%s\"\n", v->fs_type);
 | 
			
		||||
    LOGE("no misc partition\n");
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int set_bootloader_message(const struct bootloader_message *in) {
 | 
			
		||||
    Volume* v = volume_for_path("/misc");
 | 
			
		||||
    if (strcmp(v->fs_type, "mtd") == 0) {
 | 
			
		||||
        return set_bootloader_message_mtd(in, v);
 | 
			
		||||
    } else if (strcmp(v->fs_type, "emmc") == 0) {
 | 
			
		||||
        return set_bootloader_message_block(in, v);
 | 
			
		||||
    if(v)
 | 
			
		||||
    {
 | 
			
		||||
        if (strcmp(v->fs_type, "mtd") == 0) {
 | 
			
		||||
            return set_bootloader_message_mtd(in, v);
 | 
			
		||||
        } else if (strcmp(v->fs_type, "emmc") == 0) {
 | 
			
		||||
            return set_bootloader_message_block(in, v);
 | 
			
		||||
        }
 | 
			
		||||
        LOGE("unknown misc partition fs_type \"%s\"\n", v->fs_type);
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
    LOGE("unknown misc partition fs_type \"%s\"\n", v->fs_type);
 | 
			
		||||
    LOGE("no misc partition\n");
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user