Use err() instead of error() in mkbootfs
error() is a glibc extension that is not available in musl libc. err() is a BSD extension, but is present in glibc, musl libc and bionic. Test: m USE_HOST_MUSL=true host-native -k Change-Id: I2ba7bddc2a725826be8be7f80208587b81de9238
This commit is contained in:
parent
177f5b1822
commit
6f2ae489d7
1 changed files with 5 additions and 7 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
|
|
||||||
#include <error.h>
|
#include <ctype.h>
|
||||||
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
@ -342,8 +342,7 @@ static void read_canned_config(char* filename)
|
||||||
static void devnodes_desc_error(const char* filename, unsigned long line_num,
|
static void devnodes_desc_error(const char* filename, unsigned long line_num,
|
||||||
const char* msg)
|
const char* msg)
|
||||||
{
|
{
|
||||||
error(EXIT_FAILURE, 0, "failed to read nodes desc file '%s' line %lu: %s",
|
errx(EXIT_FAILURE, "failed to read nodes desc file '%s' line %lu: %s", filename, line_num, msg);
|
||||||
filename, line_num, msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int append_devnodes_desc_dir(char* path, char* args)
|
static int append_devnodes_desc_dir(char* path, char* args)
|
||||||
|
|
@ -388,8 +387,7 @@ static int append_devnodes_desc_nod(char* path, char* args)
|
||||||
static void append_devnodes_desc(const char* filename)
|
static void append_devnodes_desc(const char* filename)
|
||||||
{
|
{
|
||||||
FILE* f = fopen(filename, "re");
|
FILE* f = fopen(filename, "re");
|
||||||
if (!f) error(EXIT_FAILURE, errno,
|
if (!f) err(EXIT_FAILURE, "failed to open nodes description file '%s'", filename);
|
||||||
"failed to open nodes description file '%s'", filename);
|
|
||||||
|
|
||||||
char *line, *args, *type, *path;
|
char *line, *args, *type, *path;
|
||||||
unsigned long line_num = 0;
|
unsigned long line_num = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue