iio: Fix sysfs attribute verification failing

sysfs usually appends newlines at the end of attributes to make them
easier to consume, but the test suite can't test for that.

** (iio-sensor-proxy:4882): WARNING **: 14:14:46.792: Possible failure in string write of 'accel_3d-dev0
' Should be 'accel_3d-dev0' written to /sys/devices/platform/AMDI0010:02/i2c-2/i2c-BMA250E:00/0018:6243:0001.0002/HID-SENSOR-200073.2.auto/iio:device0/trigger/current_trigger

Closes: #347

Fixes: ac053f8a12
This commit is contained in:
Bastien Nocera
2022-03-29 21:55:35 +02:00
parent 3d67c6dc83
commit ad2c296b46

View File

@@ -416,7 +416,7 @@ _write_sysfs_string (const char *filename,
return 0;
g_clear_pointer (&sysfsfp, fclose);
if (!g_file_get_contents (temp, &contents, NULL, NULL) ||
g_strcmp0 (contents, val) != 0) {
g_strcmp0 (g_strchomp (contents), val) != 0) {
g_warning ("Possible failure in string write of '%s' Should be '%s' written to %s\n",
contents ?: "(null)", val, temp);
return -1;