chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libudev: fix --disable-log
[elogind.git]
/
udev
/
lib
/
libudev.c
diff --git
a/udev/lib/libudev.c
b/udev/lib/libudev.c
index 56bd47741dc9f3fa89a31952a548c9a8c6c2294c..a8a8a5ac3a7e42629f642af2e2125ab26ef29281 100644
(file)
--- a/
udev/lib/libudev.c
+++ b/
udev/lib/libudev.c
@@
-22,6
+22,7
@@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
+#include <stdarg.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
@@
-32,6
+33,13
@@
#include "libudev-private.h"
#include "../udev.h"
#include "libudev-private.h"
#include "../udev.h"
+struct udev {
+ int refcount;
+ void (*log_fn)(struct udev *udev,
+ int priority, const char *file, int line, const char *fn,
+ const char *format, va_list args);
+};
+
void udev_log(struct udev *udev,
int priority, const char *file, int line, const char *fn,
const char *format, ...)
void udev_log(struct udev *udev,
int priority, const char *file, int line, const char *fn,
const char *format, ...)
@@
-110,6
+118,8
@@
struct udev *udev_new(void)
**/
struct udev *udev_ref(struct udev *udev)
{
**/
struct udev *udev_ref(struct udev *udev)
{
+ if (udev == NULL)
+ return NULL;
udev->refcount++;
return udev;
}
udev->refcount++;
return udev;
}
@@
-124,6
+134,8
@@
struct udev *udev_ref(struct udev *udev)
**/
void udev_unref(struct udev *udev)
{
**/
void udev_unref(struct udev *udev)
{
+ if (udev == NULL)
+ return;
udev->refcount--;
if (udev->refcount > 0)
return;
udev->refcount--;
if (udev->refcount > 0)
return;
@@
-164,6
+176,8
@@
void udev_set_log_fn(struct udev *udev,
**/
const char *udev_get_sys_path(struct udev *udev)
{
**/
const char *udev_get_sys_path(struct udev *udev)
{
+ if (udev == NULL)
+ return NULL;
return sysfs_path;
}
return sysfs_path;
}
@@
-179,5
+193,7
@@
const char *udev_get_sys_path(struct udev *udev)
**/
const char *udev_get_dev_path(struct udev *udev)
{
**/
const char *udev_get_dev_path(struct udev *udev)
{
+ if (udev == NULL)
+ return NULL;
return udev_root;
}
return udev_root;
}