Ensure that O_CREAT and O_TMPFILE are unique

This commit is contained in:
Jeroen Ketema
2022-02-03 11:24:20 +01:00
parent e1ca5dd120
commit 4d03082f16

View File

@@ -15,15 +15,21 @@ int parseHex(string input) {
}
int o_creat() {
exists(Macro m | m.getName() = "O_CREAT" |
result = parseHex(m.getBody()) or result = UnixConstants::parseOctal(m.getBody())
)
result =
unique(int v |
exists(Macro m | m.getName() = "O_CREAT" |
v = parseHex(m.getBody()) or v = UnixConstants::parseOctal(m.getBody())
)
)
}
int o_tmpfile() {
exists(Macro m | m.getName() = "O_TMPFILE" |
result = parseHex(m.getBody()) or result = UnixConstants::parseOctal(m.getBody())
)
result =
unique(int v |
exists(Macro m | m.getName() = "O_TMPFILE" |
v = parseHex(m.getBody()) or v = UnixConstants::parseOctal(m.getBody())
)
)
}
bindingset[n, digit]