File: kexec-elf-core.c

package info (click to toggle)
kexec-tools 1%3A2.0.20-2.1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 2,828 kB
  • sloc: ansic: 27,201; sh: 3,486; asm: 2,625; cpp: 1,752; makefile: 930
file content (29 lines) | stat: -rw-r--r-- 561 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <stdlib.h>
#include "elf.h"
#include "kexec-elf.h"


int build_elf_core_info(const char *buf, off_t len, struct mem_ehdr *ehdr,
				uint32_t flags)
{
	int result;
	result = build_elf_info(buf, len, ehdr, flags);
	if (result < 0) {
		return result;
	}
	if ((ehdr->e_type != ET_CORE)) {
		/* not an ELF Core */
		fprintf(stderr, "Not ELF type ET_CORE\n");
		return -1;
	}
	if (!ehdr->e_phdr) {
		/* No program header */
		fprintf(stderr, "No ELF program header\n");
		return -1;
	}

	return 0;
}