mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-21 18:03:41 +03:00
udev/udev-watch: calculate the real buffer sizes needed
This commit is contained in:
parent
a6eccc3647
commit
e02c613560
@ -337,7 +337,7 @@ out:
|
|||||||
void udev_node_add(struct udev_device *dev, bool apply,
|
void udev_node_add(struct udev_device *dev, bool apply,
|
||||||
mode_t mode, uid_t uid, gid_t gid,
|
mode_t mode, uid_t uid, gid_t gid,
|
||||||
struct udev_list *seclabel_list) {
|
struct udev_list *seclabel_list) {
|
||||||
char filename[UTIL_PATH_SIZE];
|
char filename[sizeof("/dev/block/:") + 2*DECIMAL_STR_MAX(unsigned)];
|
||||||
struct udev_list_entry *list_entry;
|
struct udev_list_entry *list_entry;
|
||||||
|
|
||||||
log_debug("handling device node '%s', devnum=%s, mode=%#o, uid="UID_FMT", gid="GID_FMT,
|
log_debug("handling device node '%s', devnum=%s, mode=%#o, uid="UID_FMT", gid="GID_FMT,
|
||||||
@ -360,7 +360,7 @@ void udev_node_add(struct udev_device *dev, bool apply,
|
|||||||
|
|
||||||
void udev_node_remove(struct udev_device *dev) {
|
void udev_node_remove(struct udev_device *dev) {
|
||||||
struct udev_list_entry *list_entry;
|
struct udev_list_entry *list_entry;
|
||||||
char filename[UTIL_PATH_SIZE];
|
char filename[sizeof("/dev/block/:") + 2*DECIMAL_STR_MAX(unsigned)];
|
||||||
|
|
||||||
/* remove/update symlinks, remove symlinks from name index */
|
/* remove/update symlinks, remove symlinks from name index */
|
||||||
udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev))
|
udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev))
|
||||||
|
@ -89,7 +89,7 @@ unlink:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void udev_watch_begin(struct udev *udev, struct udev_device *dev) {
|
void udev_watch_begin(struct udev *udev, struct udev_device *dev) {
|
||||||
char filename[UTIL_PATH_SIZE];
|
char filename[sizeof("/run/udev/watch/") + DECIMAL_STR_MAX(int)];
|
||||||
int wd;
|
int wd;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) {
|
|||||||
|
|
||||||
void udev_watch_end(struct udev *udev, struct udev_device *dev) {
|
void udev_watch_end(struct udev *udev, struct udev_device *dev) {
|
||||||
int wd;
|
int wd;
|
||||||
char filename[UTIL_PATH_SIZE];
|
char filename[sizeof("/run/udev/watch/") + DECIMAL_STR_MAX(int)];
|
||||||
|
|
||||||
if (inotify_fd < 0)
|
if (inotify_fd < 0)
|
||||||
return;
|
return;
|
||||||
@ -135,7 +135,7 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct udev_device *udev_watch_lookup(struct udev *udev, int wd) {
|
struct udev_device *udev_watch_lookup(struct udev *udev, int wd) {
|
||||||
char filename[UTIL_PATH_SIZE];
|
char filename[sizeof("/run/udev/watch/") + DECIMAL_STR_MAX(int)];
|
||||||
char device[UTIL_NAME_SIZE];
|
char device[UTIL_NAME_SIZE];
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user