File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,8 @@ type Capabilities interface {
6060	Apply (kind  CapType ) error 
6161}
6262
63- // NewPid create new initialized Capabilities object for given pid. 
63+ // NewPid create new initialized Capabilities object for given pid when it 
64+ // is nonzero, or for the current pid if pid is 0 
6465func  NewPid (pid  int ) (Capabilities , error ) {
6566	return  newPid (pid )
6667}
Original file line number Diff line number Diff line change @@ -351,7 +351,15 @@ func (c *capsV3) Load() (err error) {
351351		return 
352352	}
353353
354- 	f , err  :=  os .Open (fmt .Sprintf ("/proc/%d/status" , c .hdr .pid ))
354+ 	var  status_path  string 
355+ 
356+ 	if  c .hdr .pid  ==  0  {
357+ 		status_path  =  fmt .Sprintf ("/proc/self/status" )
358+ 	} else  {
359+ 		status_path  =  fmt .Sprintf ("/proc/%d/status" , c .hdr .pid )
360+ 	}
361+ 
362+ 	f , err  :=  os .Open (status_path )
355363	if  err  !=  nil  {
356364		return 
357365	}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments