@@ -1325,7 +1325,7 @@ static int trigger_device(Manager *m, sd_device *parent) {
13251325 return 0 ;
13261326}
13271327
1328- static int attach_device (Manager * m , const char * seat , const char * sysfs ) {
1328+ static int attach_device (Manager * m , const char * seat , const char * sysfs , sd_bus_error * error ) {
13291329 _cleanup_ (sd_device_unrefp ) sd_device * d = NULL ;
13301330 _cleanup_free_ char * rule = NULL , * file = NULL ;
13311331 const char * id_for_seat ;
@@ -1337,13 +1337,13 @@ static int attach_device(Manager *m, const char *seat, const char *sysfs) {
13371337
13381338 r = sd_device_new_from_syspath (& d , sysfs );
13391339 if (r < 0 )
1340- return r ;
1340+ return sd_bus_error_set_errnof ( error , r , "Failed to open device '%s': %m" , sysfs ) ;
13411341
13421342 if (sd_device_has_current_tag (d , "seat" ) <= 0 )
1343- return - ENODEV ;
1343+ return sd_bus_error_set_errnof ( error , ENODEV , "Device '%s' lacks 'seat' udev tag." , sysfs ) ;
13441344
13451345 if (sd_device_get_property_value (d , "ID_FOR_SEAT" , & id_for_seat ) < 0 )
1346- return - ENODEV ;
1346+ return sd_bus_error_set_errnof ( error , ENODEV , "Device '%s' lacks 'ID_FOR_SEAT' udev property." , sysfs ) ;
13471347
13481348 if (asprintf (& file , "/etc/udev/rules.d/72-seat-%s.rules" , id_for_seat ) < 0 )
13491349 return - ENOMEM ;
@@ -1428,7 +1428,7 @@ static int method_attach_device(sd_bus_message *message, void *userdata, sd_bus_
14281428 if (r == 0 )
14291429 return 1 ; /* No authorization for now, but the async polkit stuff will call us again when it has it */
14301430
1431- r = attach_device (m , seat , sysfs );
1431+ r = attach_device (m , seat , sysfs , error );
14321432 if (r < 0 )
14331433 return r ;
14341434
0 commit comments