158 |
|
char *value; |
159 |
|
int instance; |
160 |
|
if ((root_node = di_init("/", DINFOCPYALL)) == DI_NODE_NIL) { |
161 |
< |
fprintf(stderr, "di_init() failed\n"); |
162 |
< |
exit(1); |
161 |
> |
return 1; |
162 |
|
} |
163 |
|
node = di_drv_first_node(alias, root_node); |
164 |
|
while (node != DI_NODE_NIL) { |
168 |
|
minor_name = di_minor_name(minor); |
169 |
|
strcpy(tmpnode, alias); |
170 |
|
sprintf(tmpnode, "%s%d", tmpnode, instance); |
171 |
< |
strcpy(file, "/devices"); |
172 |
< |
strcat(file, phys_path); |
173 |
< |
strcat(file, ":"); |
174 |
< |
strcat(file, minor_name); |
171 |
> |
strlcpy(file, "/devices", sizeof file); |
172 |
> |
strlcat(file, phys_path, sizeof file); |
173 |
> |
strlcat(file, ":", sizeof file); |
174 |
> |
strlcat(file, minor_name, sizeof file); |
175 |
|
value = read_dir(file); |
176 |
|
if (value != NULL){ |
177 |
|
add_mapping(tmpnode, value); |
183 |
|
} |
184 |
|
} |
185 |
|
di_fini(root_node); |
186 |
< |
return (-1); |
186 |
> |
return 0; |
187 |
|
} |
188 |
|
|
189 |
< |
void build_mapping(){ |
189 |
> |
int build_mapping(){ |
190 |
|
char device_name[512]; |
191 |
|
int x; |
192 |
|
kstat_ctl_t *kc; |
209 |
|
} |
210 |
|
if(x == sizeof device_name) x--; |
211 |
|
device_name[x] = '\0'; |
212 |
< |
get_alias(device_name); |
212 |
> |
if((get_alias(device_name)) != 0){ |
213 |
> |
return 1; |
214 |
> |
} |
215 |
|
} |
216 |
|
} |
217 |
|
|
218 |
< |
return; |
218 |
> |
return 0; |
219 |
|
} |
220 |
|
|
221 |
|
#endif |
333 |
|
} |
334 |
|
#endif |
335 |
|
#ifdef SOLARIS |
336 |
< |
build_mapping(); |
336 |
> |
if((build_mapping()) != 0) return 1; |
337 |
|
#endif |
338 |
|
return 0; |
339 |
|
} |