X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udev.h;h=3b676acf40d99ab1a7a137dbbe49804b80f6ecde;hp=fa56c366911a511e15fed9b2b5bb8e05633ad994;hb=dde05ccb8d423fbc5c29f54b0c1b545938c8f151;hpb=e964c2c05d3d6e2bdb21b3461ed7a4e85315cbc1 diff --git a/udev.h b/udev.h index fa56c3669..3b676acf4 100644 --- a/udev.h +++ b/udev.h @@ -90,7 +90,7 @@ static inline char *get_action(void) char *action; action = getenv("ACTION"); - if (strlen(action) > ACTION_SIZE) + if (action != NULL && strlen(action) > ACTION_SIZE) action[ACTION_SIZE-1] = '\0'; return action; @@ -101,7 +101,7 @@ static inline char *get_devpath(void) char *devpath; devpath = getenv("DEVPATH"); - if (strlen(devpath) > DEVPATH_SIZE) + if (devpath != NULL && strlen(devpath) > DEVPATH_SIZE) devpath[DEVPATH_SIZE-1] = '\0'; return devpath; @@ -118,7 +118,7 @@ static inline char *get_seqnum(void) static inline char *get_subsystem(char *subsystem) { - if (strlen(subsystem) > SUBSYSTEM_SIZE) + if (subsystem != NULL && strlen(subsystem) > SUBSYSTEM_SIZE) subsystem[SUBSYSTEM_SIZE-1] = '\0'; return subsystem;