@@ -152,7 +152,9 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
152152 if (verify ) {
153153 r = chase_symlinks (_syspath , NULL , 0 , & syspath , NULL );
154154 if (r == - ENOENT )
155- return - ENODEV ; /* the device does not exist (any more?) */
155+ /* the device does not exist (any more?) */
156+ return log_debug_errno (SYNTHETIC_ERRNO (ENODEV ),
157+ "sd-device: Failed to chase symlinks in \"%s\"." , _syspath );
156158 if (r < 0 )
157159 return log_debug_errno (r , "sd-device: Failed to get target of '%s': %m" , _syspath );
158160
@@ -173,7 +175,7 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
173175
174176 new_syspath = path_join ("/sys" , p );
175177 if (!new_syspath )
176- return - ENOMEM ;
178+ return log_oom_debug () ;
177179
178180 free_and_replace (syspath , new_syspath );
179181 path_simplify (syspath );
@@ -187,30 +189,31 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
187189 if (access (path , F_OK ) < 0 ) {
188190 if (errno == ENOENT )
189191 /* this is not a valid device */
190- return - ENODEV ;
192+ return log_debug_errno (SYNTHETIC_ERRNO (ENODEV ),
193+ "sd-device: the uevent file \"%s\" does not exist." , path );
191194
192195 return log_debug_errno (errno , "sd-device: cannot access uevent file for %s: %m" , syspath );
193196 }
194197 } else {
195198 /* everything else just needs to be a directory */
196199 if (!is_dir (syspath , false))
197- return - ENODEV ;
200+ return log_debug_errno (SYNTHETIC_ERRNO (ENODEV ),
201+ "sd-device: the syspath \"%s\" is not a directory." , syspath );
198202 }
199203 } else {
200204 syspath = strdup (_syspath );
201205 if (!syspath )
202- return - ENOMEM ;
206+ return log_oom_debug () ;
203207 }
204208
205209 devpath = syspath + STRLEN ("/sys" );
206210
207211 if (devpath [0 ] != '/' )
208- /* '/sys' alone is not a valid device path */
209- return - ENODEV ;
212+ return log_debug_errno (SYNTHETIC_ERRNO (ENODEV ), "sd-device: \"/sys\" alone is not a valid device path." );
210213
211214 r = device_add_property_internal (device , "DEVPATH" , devpath );
212215 if (r < 0 )
213- return r ;
216+ return log_debug_errno ( r , "sd-device: Failed to add \"DEVPATH\" property for device \"%s\": %m" , syspath ) ;
214217
215218 free_and_replace (device -> syspath , syspath );
216219 device -> devpath = devpath ;
0 commit comments