Commit 9f2dd48
src: remove uid_t/gid_t casts
If uid_t/gid_t are uint32_t, then the casts are unnecessary. This
appears to be true in all recent versions of all supported platforms,
so this change makes that assumption explicit and removes the casts.
Conversely, if uid_t/gid_t are smaller unsigned integer types (such as
uint16_t in earlier versions of Linux) or signed integer types (such as
int32_t), then the casts are potentially dangerous because they might
change the value of the uid/gid. If this happens on any platform, the
added static_assert will fail, and additional bound checks should be
introduced.
PR-URL: #44914
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>1 parent 8c69da8 commit 9f2dd48
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
| 219 | + | |
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
| |||
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
227 | | - | |
| 228 | + | |
| 229 | + | |
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
| |||
0 commit comments