ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/tools.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/tools.c (file contents):
Revision 1.16 by tdb, Thu Nov 20 12:13:12 2003 UTC vs.
Revision 1.17 by pajs, Mon Jan 5 14:21:07 2004 UTC

# Line 158 | Line 158 | int get_alias(char *alias){
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) {
# Line 169 | Line 168 | int get_alias(char *alias){
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);
# Line 184 | Line 183 | int get_alias(char *alias){
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;
# Line 210 | Line 209 | void build_mapping(){
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
# Line 332 | Line 333 | int statgrab_init(){
333          }
334   #endif
335   #ifdef SOLARIS
336 <        build_mapping();
336 >        if((build_mapping()) != 0) return 1;
337   #endif
338          return 0;
339   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines