discards the high bits, so "mkdir -m 1777 foo" won't set the sticky bit. So call chmod() on the directory.