getgrouplist requires file locking

General support questions
Post Reply
himdeep
Posts: 2
Joined: 2017/08/11 12:05:59

getgrouplist requires file locking

Post by himdeep » 2017/08/16 09:15:27

Is it required to lock /etc/group before calling getgrouplist() syscall.
Assume some other process is modifying /etc/group using command/ or syscall ?
So is it required any preventive mechanism to avoid any race condition/file corruption ?

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: getgrouplist requires file locking

Post by aks » 2017/08/17 16:48:28

(unless I misunderstand you). Yes, it's locked - assuming write exclusive lock - you can spin around waiting for the lock to be released or fail.

Post Reply