@@ -355,14 +355,7 @@ static void save_initpid(ino_t pidns_inode, pid_t pid)
355
355
lxcfs_debug ("Added cache entry %d for pid %d to init pid cache" , ino_hash , pid );
356
356
}
357
357
358
- /*
359
- * Given the stat(2) info for a nsfd pid inode, lookup the init_pid_store
360
- * entry for the inode number and creation time. Verify that the init pid
361
- * is still valid. If not, remove it. Return the entry if valid, NULL
362
- * otherwise.
363
- * Must be called under store_lock
364
- */
365
- static pid_t lookup_verify_initpid (ino_t pidns_inode )
358
+ static struct pidns_store * lookup_verify_pidns_entry (ino_t pidns_inode )
366
359
{
367
360
struct pidns_store * entry ;
368
361
@@ -375,16 +368,33 @@ static pid_t lookup_verify_initpid(ino_t pidns_inode)
375
368
if (entry -> ino == pidns_inode ) {
376
369
if (initpid_still_valid (entry )) {
377
370
entry -> lastcheck = time (NULL );
378
- return entry -> initpid ;
371
+ return entry ;
379
372
}
380
373
381
374
remove_initpid (entry );
382
- return ret_errno ( ESRCH ) ;
375
+ return NULL ;
383
376
}
384
377
entry = entry -> next ;
385
378
}
386
379
387
- return ret_errno (ESRCH );
380
+ return NULL ;
381
+ }
382
+
383
+ /*
384
+ * Given the stat(2) info for a nsfd pid inode, lookup the init_pid_store
385
+ * entry for the inode number and creation time. Verify that the init pid
386
+ * is still valid. If not, remove it. Return the entry if valid, NULL
387
+ * otherwise.
388
+ * Must be called under store_lock
389
+ */
390
+ static pid_t lookup_verify_initpid (ino_t pidns_inode )
391
+ {
392
+ struct pidns_store * entry = lookup_verify_pidns_entry (pidns_inode );
393
+
394
+ if (!entry )
395
+ return ret_errno (ESRCH );
396
+
397
+ return entry -> initpid ;
388
398
}
389
399
390
400
static bool send_creds_ok (int sock_fd )
0 commit comments