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.50 by pajs, Wed Apr 7 15:46:34 2004 UTC vs.
Revision 1.51 by tdb, Wed Apr 7 21:08:40 2004 UTC

# Line 267 | Line 267 | static int build_mapping(){
267   #endif
268  
269  
270
270   char *sg_f_read_line(FILE *f, const char *string){
271          /* Max line length. 8k should be more than enough */
272          static char line[8192];
# Line 278 | Line 277 | char *sg_f_read_line(FILE *f, const char *string){
277                  }
278          }
279  
280 +        sg_set_error(SG_ERROR_PARSE, NULL);
281          return NULL;
282   }
283  
# Line 292 | Line 292 | char *sg_get_string_match(char *line, regmatch_t *matc
292   }
293  
294  
295
295   #ifndef HAVE_ATOLL
296   static long long atoll(const char *s) {
297          long long value = 0;
# Line 450 | Line 449 | kvm_t *sg_get_kvm() {
449          }
450  
451          kvmd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
452 +        if(kvmd == NULL) {
453 +                sg_set_error(SG_ERROR_KVM_OPENFILES, NULL);
454 +        }
455          return kvmd;
456   }
457  
# Line 462 | Line 464 | kvm_t *sg_get_kvm2() {
464          }
465  
466          kvmd2 = kvm_openfiles(_PATH_DEVNULL, _PATH_DEVNULL, NULL, O_RDONLY, NULL);
467 +        if(kvmd2 == NULL) {
468 +                sg_set_error(SG_ERROR_KVM_OPENFILES, NULL);
469 +        }
470          return kvmd2;
471   }
472   #endif
# Line 477 | Line 482 | struct uvmexp *sg_get_uvmexp() {
482          mib[1] = VM_UVMEXP;
483  
484          if (sysctl(mib, 2, &uvm, &size, NULL, 0) < 0) {
485 +                sg_set_error(SG_ERROR_SYSCTL, "CTL_VM.VM_UVMEXP");
486                  return NULL;
487          }
488  
# Line 506 | Line 512 | int sg_init(){
512   }
513  
514   int sg_drop_privileges() {
515 <        if (setegid(getgid()) != 0) return -1;
516 <        if (seteuid(getuid()) != 0) return -1;
515 >        if (setegid(getgid()) != 0) {
516 >                sg_set_error(SG_ERROR_SETEGID, NULL);
517 >                return -1;
518 >        }
519 >        if (seteuid(getuid()) != 0) {
520 >                sg_set_error(SG_ERROR_SETEUID, NULL);
521 >                return -1;
522 >        }
523          return 0;
524   }
525  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines