1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 10:51:20 +03:00

udevadm-info: use strdup() instead of strscpy()

This commit is contained in:
Yu Watanabe 2018-10-02 16:23:50 +09:00
parent c7d942d6ca
commit c4abe7191a

View File

@ -12,12 +12,12 @@
#include "sd-device.h"
#include "alloc-util.h"
#include "device-enumerator-private.h"
#include "device-private.h"
#include "device-util.h"
#include "dirent-util.h"
#include "fd-util.h"
#include "libudev-private.h"
#include "string-util.h"
#include "udevadm.h"
#include "udevadm-util.h"
@ -252,10 +252,9 @@ static int help(void) {
int info_main(int argc, char *argv[], void *userdata) {
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
bool root = 0;
bool export = 0;
bool root = false, export = false;
_cleanup_free_ char *name = NULL;
const char *export_prefix = NULL;
char name[UTIL_PATH_SIZE];
int c, r;
static const struct option options[] = {
@ -332,7 +331,9 @@ int info_main(int argc, char *argv[], void *userdata) {
break;
case 'd':
action = ACTION_DEVICE_ID_FILE;
strscpy(name, sizeof(name), optarg);
name = strdup(optarg);
if (!name)
return log_oom();
break;
case 'a':
action = ACTION_ATTRIBUTE_WALK;