code: func nextUID(isSystem bool) (db *dbfile, uid int, err error) {
  	loadConfig()
  
  	db, err = openDBFile(_USER_FILE, os.O_RDWR)
  	if err != nil {
  		return
  	}
  
  	// Seek to file half size.
  
  	info, err := db.file.Stat()
  	if err != nil {
  		db.close()
  		return nil, 0, err
  	}
  	if _, err = db.file.Seek(info.Size()/2, os.SEEK_SET); err != nil {
  		db.close()
  		return nil, 0, err
  	}
  	// To starting to read from a new line
  	if _, _, err = db.rd.ReadLine(); err != nil {
  		db.close()
  		return nil, 0, err
  	}
  
  	var minUid, maxUid int
  	if isSystem {
  		minUid, maxUid = config.login.SYS_UID_MIN, config.login.SYS_UID_MAX
  	} else {
  		minUid, maxUid = config.login.UID_MIN, config.login.UID_MAX
  	}
  
  	for {
  		line, _, err := db.rd.ReadLine()
  		if err == io.EOF {
  			break
  		}
  
  		u, err := parseUser(string(line))
  		if err != nil {
  			db.close()
  			return nil, 0, err
  		}
  		if u.UID >= minUid && u.UID <= maxUid {
  			uid = u.UID
  		}
  	}
  
  	uid++
  	if uid == maxUid {
  		return nil, 0, &IdRangeError{maxUid, isSystem, true}
  	}
  	return
  }
docs: // nextUID returns the next free user id to use, according to whether it is a
  // system's user.