chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] udev - safer string handling all over the place
[elogind.git]
/
namedev.c
diff --git
a/namedev.c
b/namedev.c
index 90c85d41e4d8571926bae2233adc8559cfa3c919..219cb8a4b84406b63f7cfcf8917eb08fcb9eee66 100644
(file)
--- a/
namedev.c
+++ b/
namedev.c
@@
-33,12
+33,12
@@
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/stat.h>
+#include "libsysfs/sysfs/libsysfs.h"
#include "list.h"
#include "udev.h"
#include "udev_version.h"
#include "logging.h"
#include "namedev.h"
#include "list.h"
#include "udev.h"
#include "udev_version.h"
#include "logging.h"
#include "namedev.h"
-#include "libsysfs/libsysfs.h"
#include "klibc_fixups.h"
static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr);
#include "klibc_fixups.h"
static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr);
@@
-157,7
+157,7
@@
static mode_t get_default_mode(void)
static char *get_default_owner(void)
{
if (strlen(default_owner_str) == 0)
static char *get_default_owner(void)
{
if (strlen(default_owner_str) == 0)
- str
ncpy(default_owner_str, "root", OWNER_SIZE
);
+ str
fieldcpy(default_owner_str, "root"
);
return default_owner_str;
}
return default_owner_str;
}
@@
-165,7
+165,7
@@
static char *get_default_owner(void)
static char *get_default_group(void)
{
if (strlen(default_group_str) == 0)
static char *get_default_group(void)
{
if (strlen(default_group_str) == 0)
- str
ncpy(default_group_str, "root", GROUP_SIZE
);
+ str
fieldcpy(default_group_str, "root"
);
return default_group_str;
}
return default_group_str;
}
@@
-276,7
+276,7
@@
static void apply_format(struct udevice *udev, unsigned char *string, struct sys
if (attr != NULL)
i = atoi(attr);
if (i > 0) {
if (attr != NULL)
i = atoi(attr);
if (i > 0) {
- str
ncpy(temp1, udev->program_result, sizeof(temp1)
);
+ str
fieldcpy(temp1, udev->program_result
);
pos2 = temp1;
while (i) {
i--;
pos2 = temp1;
while (i) {
i--;
@@
-837,8
+837,8
@@
done:
} else {
/* no matching perms found :( */
udev->mode = get_default_mode();
} else {
/* no matching perms found :( */
udev->mode = get_default_mode();
- str
ncpy(udev->owner, get_default_owner(), OWNER_SIZE
);
- str
ncpy(udev->group, get_default_group(), GROUP_SIZE
);
+ str
fieldcpy(udev->owner, get_default_owner()
);
+ str
fieldcpy(udev->group, get_default_group()
);
}
dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o",
udev->name, udev->owner, udev->group, udev->mode);
}
dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o",
udev->name, udev->owner, udev->group, udev->mode);