On Fri, May 24, 2024 at 08:22:05PM +0200, Bartosz Golaszewski wrote: > On Tue, Apr 23, 2024 at 8:23 PM Andy Shevchenko > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote: > > On Fri, Apr 12, 2024 at 02:27:52PM +0200, Bartosz Golaszewski wrote: > > > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> ... > > > + ret = g_gpiod_line_request_set_value(data->request, data->line_offset, > > > + data->value, &err); > > > + if (!ret) { > > > > ret == 0 equals error?! > > It returns gboolean where false means error. This is a pattern in GLib. For booleans we have a pattern like if (bool_func(...)) to imply it. ret = int_func(...); if (ret) // if (!ret) kinda implies int. Does Glib has that type of pattern? > > > + g_printerr("failed to set line value: %s\n", err->message); > > > + exit(EXIT_FAILURE); > > > > Don't you have something like err->code to propagate? > > What for? err->message is the human-readable string of the error. If somebody wants to parse this with a script? -- With Best Regards, Andy Shevchenko