#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <sys/stat.h>
#include <unistd.h>
+#include <fcntl.h>
+
#include "udev.h"
#include "udev_lib.h"
+#include "udevdb.h"
#include "logging.h"
#define DEVD_DIR "/etc/dev.d/"
static int run_program(char *name)
{
pid_t pid;
+ int fd;
dbg("running %s", name);
switch (pid) {
case 0:
/* child */
+ udevdb_exit(); /* close udevdb */
+ fd = open("/dev/null", O_RDWR);
+ if ( fd >= 0) {
+ dup2(fd, STDOUT_FILENO);
+ dup2(fd, STDIN_FILENO);
+ dup2(fd, STDERR_FILENO);
+ }
+ close(fd);
execv(name, main_argv);
dbg("exec of child failed");
exit(1);
* subsystem/
* default/
*/
-void dev_d_send(struct udevice *dev, char *subsystem, char *devpath)
+void dev_d_send(struct udevice *dev, const char *subsystem, const char *devpath)
{
char dirname[256];
char env_devname[NAME_SIZE];
if (udev_dev_d == 0)
return;
+ memset(env_devname, 0x00, sizeof(env_devname));
if (dev->type == 'b' || dev->type == 'c') {
strfieldcpy(env_devname, udev_root);
strfieldcat(env_devname, dev->name);