Skip to content

Commit ddd495e

Browse files
committed
Return error from dbus calls
1 parent b35b012 commit ddd495e

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

login1/dbus.go

+24-16
Original file line numberDiff line numberDiff line change
@@ -324,42 +324,50 @@ func (c *Conn) GetUserPropertyContext(ctx context.Context, userPath dbus.ObjectP
324324
}
325325

326326
// LockSession asks the session with the specified ID to activate the screen lock.
327-
func (c *Conn) LockSession(id string) {
328-
c.object.Call(dbusManagerInterface+".LockSession", 0, id)
327+
func (c *Conn) LockSession(id string) error {
328+
call := c.object.Call(dbusManagerInterface+".LockSession", 0, id)
329+
return call.Err
329330
}
330331

331332
// LockSessions asks all sessions to activate the screen locks. This may be used to lock any access to the machine in one action.
332-
func (c *Conn) LockSessions() {
333-
c.object.Call(dbusManagerInterface+".LockSessions", 0)
333+
func (c *Conn) LockSessions() error {
334+
call := c.object.Call(dbusManagerInterface+".LockSessions", 0)
335+
return call.Err
334336
}
335337

336338
// TerminateSession forcibly terminate one specific session.
337-
func (c *Conn) TerminateSession(id string) {
338-
c.object.Call(dbusManagerInterface+".TerminateSession", 0, id)
339+
func (c *Conn) TerminateSession(id string) error {
340+
call := c.object.Call(dbusManagerInterface+".TerminateSession", 0, id)
341+
return call.Err
339342
}
340343

341344
// TerminateUser forcibly terminates all processes of a user.
342-
func (c *Conn) TerminateUser(uid uint32) {
343-
c.object.Call(dbusManagerInterface+".TerminateUser", 0, uid)
345+
func (c *Conn) TerminateUser(uid uint32) error {
346+
call := c.object.Call(dbusManagerInterface+".TerminateUser", 0, uid)
347+
return call.Err
344348
}
345349

346350
// Reboot asks logind for a reboot optionally asking for auth.
347-
func (c *Conn) Reboot(askForAuth bool) {
348-
c.object.Call(dbusManagerInterface+".Reboot", 0, askForAuth)
351+
func (c *Conn) Reboot(askForAuth bool) error {
352+
call := c.object.Call(dbusManagerInterface+".Reboot", 0, askForAuth)
353+
return call.Err
349354
}
350355

351356
// RebootWithFlags asks logind for a reboot with flags.
352-
func (c *Conn) RebootWithFlags(flags uint64) {
353-
c.object.Call(dbusManagerInterface+".RebootWithFlags", 0, flags)
357+
func (c *Conn) RebootWithFlags(flags uint64) error {
358+
call := c.object.Call(dbusManagerInterface+".RebootWithFlags", 0, flags)
359+
return call.Err
354360
}
355361

356362
// ScheduleShutdown asks logind to schedule a shutdown.
357-
func (c *Conn) ScheduleShutdown(typ ScheduleShutdownType, when time.Time) {
358-
c.object.Call(dbusManagerInterface+".ScheduleShutdown", 0, typ.String(), when.UTC().UnixMicro())
363+
func (c *Conn) ScheduleShutdown(typ ScheduleShutdownType, when time.Time) error {
364+
call := c.object.Call(dbusManagerInterface+".ScheduleShutdown", 0, typ.String(), when.UTC().UnixMicro())
365+
return call.Err
359366
}
360367

361-
func (c *Conn) SetWallMessage(message string, enable bool) {
362-
c.object.Call(dbusManagerInterface+".SetWallMessage", 0, message, enable)
368+
func (c *Conn) SetWallMessage(message string, enable bool) error {
369+
call := c.object.Call(dbusManagerInterface+".SetWallMessage", 0, message, enable)
370+
return call.Err
363371
}
364372

365373
// Inhibit takes inhibition lock in logind.

0 commit comments

Comments
 (0)