assert(sd);
/* Make sure to remove the pushed fd. */
- if (sd->pushed_fd) {
- _cleanup_free_ char *m = NULL;
- const char *id;
- int r;
-
- /* Session ID does not contain separators. */
- id = sd->session->id;
- assert(*(id + strcspn(id, "-\n")) == '\0');
-
- r = asprintf(&m, "FDSTOREREMOVE=1\n"
- "FDNAME=session-%s-device-%u-%u\n",
- id, major(sd->dev), minor(sd->dev));
- if (r >= 0)
- (void) sd_notify(false, m);
- }
+ if (sd->pushed_fd)
+ (void) sd_notifyf(false,
+ "FDSTOREREMOVE=1\n"
+ "FDNAME=session-%s-device-%u-%u",
+ sd->session->id, major(sd->dev), minor(sd->dev));
session_device_stop(sd);
session_device_notify(sd, SESSION_DEVICE_RELEASE);