diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-04-07 18:48:50 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-04-07 18:48:50 +0200 |
commit | 20c03b7be2c87ef54533db849fd046d7014c36b4 (patch) | |
tree | 3fedf87ba7ae3bda4ba6649cd84095c884d88322 /src | |
parent | f68319bbb8e95e6afa5793834668b5c094616249 (diff) |
don't make up buffer sizes, use standard LINE_MAX instead
Diffstat (limited to 'src')
-rw-r--r-- | src/dbus-manager.c | 2 | ||||
-rw-r--r-- | src/log.c | 10 | ||||
-rw-r--r-- | src/manager.c | 2 | ||||
-rw-r--r-- | src/mount-setup.c | 2 | ||||
-rw-r--r-- | src/readahead-common.c | 1 | ||||
-rw-r--r-- | src/unit.c | 2 | ||||
-rw-r--r-- | src/util.c | 10 |
7 files changed, 14 insertions, 15 deletions
diff --git a/src/dbus-manager.c b/src/dbus-manager.c index 2f755bcc64..5b5bda2119 100644 --- a/src/dbus-manager.c +++ b/src/dbus-manager.c @@ -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); @@ -238,11 +238,11 @@ void log_set_max_level(int level) { } static int write_to_console( - int level, - const char*file, - int line, - const char *func, - const char *buffer) { + int level, + const char*file, + int line, + const char *func, + const char *buffer) { char location[64]; struct iovec iovec[5]; diff --git a/src/manager.c b/src/manager.c index f9b3b5956b..5cb3588c94 100644 --- a/src/manager.c +++ b/src/manager.c @@ -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)) diff --git a/src/mount-setup.c b/src/mount-setup.c index 9bc8946dba..4fa8ae5fba 100644 --- a/src/mount-setup.c +++ b/src/mount-setup.c @@ -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. */ diff --git a/src/readahead-common.c b/src/readahead-common.c index fc49a33109..8a75b2e135 100644 --- a/src/readahead-common.c +++ b/src/readahead-common.c @@ -209,7 +209,6 @@ finish: return m; } - #define BUMP_REQUEST_NR (16*1024) int bump_request_nr(const char *p) { diff --git a/src/unit.c b/src/unit.c index 32071f2170..37a7c07ae8 100644 --- a/src/unit.c +++ b/src/unit.c @@ -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)) { diff --git a/src/util.c b/src/util.c index 5daafdf7c2..d39cb48385 100644 --- a/src/util.c +++ b/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); |