mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-25 21:25:59 +07:00
don't make up buffer sizes, use standard LINE_MAX instead
This commit is contained in:
parent
f68319bbb8
commit
20c03b7be2
@ -218,7 +218,7 @@ static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_exec_output, exec_outp
|
||||
|
||||
static int bus_manager_append_tainted(Manager *m, DBusMessageIter *i, const char *property, void *data) {
|
||||
const char *t;
|
||||
char buf[64] = "", *e = buf, *p = NULL;
|
||||
char buf[LINE_MAX] = "", *e = buf, *p = NULL;
|
||||
|
||||
assert(m);
|
||||
assert(i);
|
||||
|
@ -2681,7 +2681,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
|
||||
m->n_deserializing ++;
|
||||
|
||||
for (;;) {
|
||||
char line[1024], *l;
|
||||
char line[LINE_MAX], *l;
|
||||
|
||||
if (!fgets(line, sizeof(line), f)) {
|
||||
if (feof(f))
|
||||
|
@ -134,7 +134,7 @@ static int mount_one(const MountPoint *p) {
|
||||
static int mount_cgroup_controllers(void) {
|
||||
int r;
|
||||
FILE *f;
|
||||
char buf [256];
|
||||
char buf[LINE_MAX];
|
||||
|
||||
/* Mount all available cgroup controllers that are built into the kernel. */
|
||||
|
||||
|
@ -209,7 +209,6 @@ finish:
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
#define BUMP_REQUEST_NR (16*1024)
|
||||
|
||||
int bump_request_nr(const char *p) {
|
||||
|
@ -2152,7 +2152,7 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
return 0;
|
||||
|
||||
for (;;) {
|
||||
char line[1024], *l, *v;
|
||||
char line[LINE_MAX], *l, *v;
|
||||
size_t k;
|
||||
|
||||
if (!fgets(line, sizeof(line), f)) {
|
||||
|
10
src/util.c
10
src/util.c
@ -452,7 +452,7 @@ char **split_path_and_make_absolute(const char *p) {
|
||||
int get_parent_of_pid(pid_t pid, pid_t *_ppid) {
|
||||
int r;
|
||||
FILE *f;
|
||||
char fn[132], line[256], *p;
|
||||
char fn[PATH_MAX], line[LINE_MAX], *p;
|
||||
long unsigned ppid;
|
||||
|
||||
assert(pid >= 0);
|
||||
@ -2063,7 +2063,7 @@ int chvt(int vt) {
|
||||
int read_one_char(FILE *f, char *ret, bool *need_nl) {
|
||||
struct termios old_termios, new_termios;
|
||||
char c;
|
||||
char line[1024];
|
||||
char line[LINE_MAX];
|
||||
|
||||
assert(f);
|
||||
assert(ret);
|
||||
@ -2271,7 +2271,7 @@ int flush_fd(int fd) {
|
||||
pollfd.events = POLLIN;
|
||||
|
||||
for (;;) {
|
||||
char buf[1024];
|
||||
char buf[LINE_MAX];
|
||||
ssize_t l;
|
||||
int r;
|
||||
|
||||
@ -2897,7 +2897,7 @@ int getttyname_harder(int fd, char **r) {
|
||||
|
||||
int get_ctty_devnr(dev_t *d) {
|
||||
int k;
|
||||
char line[256], *p;
|
||||
char line[LINE_MAX], *p;
|
||||
unsigned long ttynr;
|
||||
FILE *f;
|
||||
|
||||
@ -2932,7 +2932,7 @@ int get_ctty_devnr(dev_t *d) {
|
||||
|
||||
int get_ctty(char **r, dev_t *_devnr) {
|
||||
int k;
|
||||
char fn[128], *s, *b, *p;
|
||||
char fn[PATH_MAX], *s, *b, *p;
|
||||
dev_t devnr;
|
||||
|
||||
assert(r);
|
||||
|
Loading…
Reference in New Issue
Block a user