aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/config
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-12-10 19:06:59 +0000
committermarha <marha@users.sourceforge.net>2010-12-10 19:06:59 +0000
commit3a20d23b48c1051e1f22295fd886cc7f643417f6 (patch)
tree5192dddd9ecf591de2e22504f7268c2935382d90 /xorg-server/config
parent531a0d974b98074978535f086a73b6b662fa0cea (diff)
downloadvcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.tar.gz
vcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.tar.bz2
vcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.zip
xserver git update 10/12/2010
Diffstat (limited to 'xorg-server/config')
-rw-r--r--xorg-server/config/hal.c13
-rw-r--r--xorg-server/config/udev.c14
2 files changed, 14 insertions, 13 deletions
diff --git a/xorg-server/config/hal.c b/xorg-server/config/hal.c
index dab35ddf7..2aff6f9fd 100644
--- a/xorg-server/config/hal.c
+++ b/xorg-server/config/hal.c
@@ -63,10 +63,8 @@ device_removed(LibHalContext *ctx, const char *udi)
{
char *value;
- value = malloc(strlen(udi) + 5); /* "hal:" + NULL */
- if (!value)
+ if (asprintf (&value, "hal:%s", udi) == -1)
return;
- sprintf(value, "hal:%s", udi);
remove_devices("hal", value);
@@ -200,7 +198,9 @@ device_added(LibHalContext *hal_ctx, const char *udi)
"config/hal: getting usb.product_id on %s "
"returned %04x\n", parent, usb_product);
if (usb_vendor && usb_product)
- attrs.usb_id = Xprintf("%04x:%04x", usb_vendor, usb_product);
+ if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_product)
+ == -1)
+ attrs.usb_id = NULL;
free(parent);
}
@@ -226,12 +226,11 @@ device_added(LibHalContext *hal_ctx, const char *udi)
add_option(&options, "driver", driver);
add_option(&options, "name", name);
- config_info = malloc(strlen(udi) + 5); /* "hal:" and NULL */
- if (!config_info) {
+ if (asprintf (&config_info, "hal:%s", udi) == -1) {
+ config_info = NULL;
LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
goto unwind;
}
- sprintf(config_info, "hal:%s", udi);
/* Check for duplicate devices */
if (device_is_duplicate(config_info))
diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c
index 88222bb01..43e653d2b 100644
--- a/xorg-server/config/udev.c
+++ b/xorg-server/config/udev.c
@@ -108,8 +108,10 @@ device_added(struct udev_device *udev_device)
/* construct USB ID in lowercase hex - "0000:ffff" */
if (product && sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
- attrs.usb_id = Xprintf("%04x:%04x", usb_vendor, usb_model);
- if (attrs.usb_id)
+ if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_model)
+ == -1)
+ attrs.usb_id = NULL;
+ else
LOG_PROPERTY(path, "PRODUCT", product);
}
}
@@ -127,9 +129,10 @@ device_added(struct udev_device *udev_device)
LOG_PROPERTY(path, "ID_INPUT.tags", tags_prop);
attrs.tags = xstrtokenize(tags_prop, ",");
- config_info = Xprintf("udev:%s", syspath);
- if (!config_info)
+ if (asprintf(&config_info, "udev:%s", syspath) == -1) {
+ config_info = NULL;
goto unwind;
+ }
if (device_is_duplicate(config_info)) {
LogMessage(X_WARNING, "config/udev: device %s already added. "
@@ -217,8 +220,7 @@ device_removed(struct udev_device *device)
char *value;
const char *syspath = udev_device_get_syspath(device);
- value = Xprintf("udev:%s", syspath);
- if (!value)
+ if (asprintf(&value, "udev:%s", syspath) == -1)
return;
remove_devices("udev", value);