When posting code, you need to use code tags. See here for what I am referring to. Here is your code with some indentation (which is preserved by using code tags):
Code:
struct elf_note {
int namesz;
int descsz;
int type;
char name[8];
};
int f2c_dump_core(const char *name, struct crashdump_foc_t *foc)
{
int file;
struct elf_note *note01;
if ((file = open(name, O_WRONLY | O_CREAT, 0777)) == NULL) {
printf("can not open core file: %s\n", strerror(errno));
return -1;
}
f2c_generate_note01(¬e01);
if (lseek(file, 116, SEEK_SET) == NULL) {
printf("seek note01 failed: %s.", strerror(errno));
return -1;
}
if (write(file, note01, sizeof(struct elf_note)) == NULL) {
printf("write note01 failed: %s.", strerror(errno));
return -1;
}
close(file);
}
int f2c_generate_note01(struct elf_note *note)
{
note->descsz = sizeof(struct elf_prpsinfo);
note->type = 3;
strcpy(note->name, "CORE");
note->namesz = sizeof(note->name);
}
As for the warning, try using some function prototypes. This ought to fix your trouble.