40 |
|
#endif |
41 |
|
|
42 |
|
#if defined(LINUX) || defined(SOLARIS) |
43 |
+ |
setutent(); |
44 |
|
while((entry=getutent()) != NULL) { |
45 |
|
if(entry->ut_type==USER_PROCESS) { |
46 |
|
user_tmp=user_list; |
53 |
|
nousers++; |
54 |
|
} |
55 |
|
} |
56 |
+ |
endutent(); |
57 |
|
#endif |
58 |
|
|
59 |
|
#ifdef FREEBSD |
80 |
|
} |
81 |
|
|
82 |
|
#endif |
83 |
< |
if (user_list==NULL) user_list=strdup(""); |
84 |
< |
xml_user_data=strf("<users><list>%s</list><count>%d</count></users>",user_list,nousers); |
83 |
> |
if (user_list==NULL){ |
84 |
> |
if((user_list=strdup("")) == NULL){ |
85 |
> |
errf("strdup failed (%m)"); |
86 |
> |
return NULL; |
87 |
> |
} |
88 |
> |
} |
89 |
> |
if((xml_user_data=strf("<users><list>%s</list><count>%d</count></users>",user_list,nousers)) == NULL){ |
90 |
> |
errf("strf failed (%m)"); |
91 |
> |
return NULL; |
92 |
> |
} |
93 |
|
if (user_list!=NULL) free(user_list); |
94 |
|
return xml_user_data; |
95 |
|
} |