-static int session_load_devices(Session *s, const char *devices) {
- const char *p;
- int r = 0;
-
- assert(s);
-
- for (p = devices;;) {
- _cleanup_free_ char *word = NULL;
- SessionDevice *sd;
- dev_t dev;
- int k;
-
- k = extract_first_word(&p, &word, NULL, 0);
- if (k == 0)
- break;
- if (k < 0) {
- r = k;
- break;
- }
-
- k = parse_dev(word, &dev);
- if (k < 0) {
- r = k;
- continue;
- }
-
- /* The file descriptors for loaded devices will be reattached later. */
- k = session_device_new(s, dev, false, &sd);
- if (k < 0)
- r = k;
- }
-
- if (r < 0)
- log_error_errno(r, "Loading session devices for session %s failed: %m", s->id);
-
- return r;
-}