| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
In case active console cannot be opened, return NULL early instead
of trying to read from errornous file descriptor.
Coverity CID: 1490087 Argument cannot be negative
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
| |
Coverity CID: 1490062 String not null terminated
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
| |
The default serial console can be set in the device tree
using the linux,stdout-path parameter (or equivalent from ACPI).
This is important for universal booting (EFI/EBBR) on ARM platforms
where the default console can be different (e.g ttyS0 vs ttyAMA0).
Signed-off-by: Mathew McBride <matt@traverse.com.au>
|
|
|
|
| |
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Subtracting some address from NULL does not necessary
results in negative value. It's lower level dependent.
In our case (IPQ4019 + Yocto + meta-openwrt) subtracting
token address from NULL strchr() return value results in
large positive number which causes out-of-boundary memory
access and eventually a segfault.
Signed-off-by: Justinas Grauslis <justinas@8devices.com>
|
|
|
|
|
|
| |
%m, aka strerror(errno) is already used. No need to repeat it. Saves 280 bytes.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|
|
|
|
|
| |
Saves 1496 bytes from compiled size under glibc. No functional difference.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|
|
|
| |
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In uClibc-ng O_PATH and O_DIRECTORY are only defined if _GNU_SOURCE is
defined.
So explicitly define _GNU_SOURCE in sources that use O_PATH and
O_DIRECTORY.
Without that extra definition that's what happens when building procd.
utils/utils.c:
------------------------->8----------------------
.../openwrt/build_dir/target-arc_arc700_uClibc-1.0.14/procd-2016-05-19/utils/utils.c:
In function 'patch_fd':
.../openwrt/build_dir/target-arc_arc700_uClibc-1.0.14/procd-2016-05-19/utils/utils.c:168:22:
error: 'O_PATH' undeclared (first use in this function)
dfd = open("/dev", O_PATH|O_DIRECTORY);
^
.../openwrt/build_dir/target-arc_arc700_uClibc-1.0.14/procd-2016-05-19/utils/utils.c:168:22:
note: each undeclared identifier is reported only once for each function
it appears in
.../openwrt/build_dir/target-arc_arc700_uClibc-1.0.14/procd-2016-05-19/utils/utils.c:168:29:
error: 'O_DIRECTORY' undeclared (first use in this function)
dfd = open("/dev", O_PATH|O_DIRECTORY);
^
CMakeFiles/init.dir/build.make:182: recipe for target
'CMakeFiles/init.dir/utils/utils.c.o' failed
------------------------->8----------------------
inittab.c:
------------------------->8----------------------
.../openwrt/build_dir/target-arc_arc700_uClibc-1.0.14/procd-2016-05-19/inittab.c:
In function 'dev_exist':
.../openwrt/build_dir/target-arc_arc700_uClibc-1.0.14/procd-2016-05-19/inittab.c:72:21:
error: 'O_PATH' undeclared (first use in this function)
dfd = open("/dev", O_PATH|O_DIRECTORY);
^
.../git/openwrt/build_dir/target-arc_arc700_uClibc-1.0.14/procd-2016-05-19/inittab.c:72:21:
note: each undeclared identifier is reported only once for each function
it appears in
.../git/openwrt/build_dir/target-arc_arc700_uClibc-1.0.14/procd-2016-05-19/inittab.c:72:28:
error: 'O_DIRECTORY' undeclared (first use in this function)
dfd = open("/dev", O_PATH|O_DIRECTORY);
^
CMakeFiles/procd.dir/build.make:134: recipe for target
'CMakeFiles/procd.dir/inittab.c.o' failed
make[6]: *** [CMakeFiles/procd.dir/inittab.c.o] Error 1
------------------------->8----------------------
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Waldemar Brodkorb <wbx@openadk.org>
Cc: John Crispin <john@phrozen.org>
Cc: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
| |
Use the O_PATH and O_DIRECTORY flags when opening the "/dev" path for the
subsequent openat() call to ensure that it is indeed a directory.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce two new helper functions to deal with stdio redirecation in a
uniform, reliable manner:
The patch_fd() function will attempt to redirect the given fd number to the
specified file, using the supplied flags for the open() syscall. When the
device is NULL, "/dev/null" is asumed, when the device is a relative path,
openat() is used to open it relative to the "/dev" directory. When the device
cannot be openend, a fallback to "/dev/null" is attempted.
The patch_stdio() function is essentially a wrapper around patch_fd(),
providing an easy interface to redirect stdin, stdout and stderr to the same
given device.
Both function return 0 on success and -1 on error. The errno variable will
be set accordingly.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
| |
Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
|
|
|
|
|
|
| |
also fix writing of 0-byte to buffer
Signed-off-by: Steven Barth <steven@midlink.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem was caused by procd not opening /dev/tty* (whichever was
specified for the ID field /etc/inittab), causing /proc/PID/fd to
point to /dev/console instead.
This is a rework of e63051d9, which did not initialise the console
pointer and did not check the tty pointer in askconsole. askfirst
was not completely fixed as it expected the console parameter on
the commandline, which is no longer necessary because procd opens
the console prior to fork()-ing.
Signed-off-by: Michel Stam <m.stam@fugro.nl>
|
|
|
|
|
|
|
| |
This reverts commit e63051d9843ddbafb1fabfd97d60e853bdeac129.
This unbreaks the initial console on UML and possibly other platforms.
Signed-off-by: Steven Barth <cyrus@openwrt.org>
|
|
|
|
|
|
| |
79872ea6 reduced the command line buffer breaking various platforms.
Signed-off-by: Steven Barth <steven@midlink.org>
|
|
|
|
| |
Signed-off-by: John Crispin <blogic@openwrt.org>
|
|
|
|
|
|
|
|
| |
The problem was caused by procd not opening /dev/tty* (whichever was
specified for the ID field /etc/inittab), causing /proc/PID/fd to
point to /dev/console instead.
Signed-off-by: Michel Stam <m.stam@fugro.nl>
|
|
|
|
| |
Signed-off-by: Michel Stam <m.stam@fugro.nl>
|
|
|
|
| |
Signed-off-by: John Crispin <blogic@openwrt.org>
|
|
split app into procd and init binaries
remove log support, this is an external service now
Signed-off-by: John Crispin <blogic@openwrt.org>
|