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