ctx = ubus_connect(NULL);
- if (!ctx || ubus_lookup_id(ctx, "session", &id))
+ if (!ctx || !obj || ubus_lookup_id(ctx, "session", &id))
goto out;
blob_buf_init(&req, 0);
printf("\t\"failure\": [ %u, \"%s\" ]\n", errno, strerror(errno));
- if (st.filefd > -1)
+ if (st.filefd > -1 && st.filename)
unlink(st.filename);
}
static const char *
lookup_executable(const char *cmd)
{
- size_t plen = 0, clen = strlen(cmd) + 1;
+ size_t plen = 0, clen;
static char path[PATH_MAX];
char *search, *p;
struct stat s;
+ if (!cmd)
+ return NULL;
+
+ clen = strlen(cmd) + 1;
+
if (!stat(cmd, &s) && S_ISREG(s.st_mode))
return cmd;