weston-launch: On error putenv returns a non-zero value

According to POSIX standard "upon successful completion, putenv() shall
return 0; otherwise, it shall return a non-zero value." Unlike in
setenv() we should not be checking only for negative values.

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
dev
Dawid Gajownik 9 years ago committed by Bryce Harrington
parent 2f7d33d984
commit f3c8336320
  1. 2
      src/weston-launch.c

@ -603,7 +603,7 @@ setup_session(struct weston_launch *wl)
env = pam_getenvlist(wl->ph); env = pam_getenvlist(wl->ph);
if (env) { if (env) {
for (i = 0; env[i]; ++i) { for (i = 0; env[i]; ++i) {
if (putenv(env[i]) < 0) if (putenv(env[i]) != 0)
error(0, 0, "putenv %s failed", env[i]); error(0, 0, "putenv %s failed", env[i]);
} }
free(env); free(env);

Loading…
Cancel
Save