mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
smbd: Simplify notify_filter_string
Just a single NULL check through talloc_asprintf_addbuf Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
6e7a1cc646
commit
a37ea9d750
@ -859,81 +859,46 @@ char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32_t filter)
|
||||
char *result = NULL;
|
||||
|
||||
result = talloc_strdup(mem_ctx, "");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (filter & FILE_NOTIFY_CHANGE_FILE_NAME) {
|
||||
result = talloc_asprintf_append(result, "FILE_NAME|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "FILE_NAME|");
|
||||
}
|
||||
if (filter & FILE_NOTIFY_CHANGE_DIR_NAME) {
|
||||
result = talloc_asprintf_append(result, "DIR_NAME|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "DIR_NAME|");
|
||||
}
|
||||
if (filter & FILE_NOTIFY_CHANGE_ATTRIBUTES) {
|
||||
result = talloc_asprintf_append(result, "ATTRIBUTES|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "ATTRIBUTES|");
|
||||
}
|
||||
if (filter & FILE_NOTIFY_CHANGE_SIZE) {
|
||||
result = talloc_asprintf_append(result, "SIZE|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "SIZE|");
|
||||
}
|
||||
if (filter & FILE_NOTIFY_CHANGE_LAST_WRITE) {
|
||||
result = talloc_asprintf_append(result, "LAST_WRITE|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "LAST_WRITE|");
|
||||
}
|
||||
if (filter & FILE_NOTIFY_CHANGE_LAST_ACCESS) {
|
||||
result = talloc_asprintf_append(result, "LAST_ACCESS|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "LAST_ACCESS|");
|
||||
}
|
||||
if (filter & FILE_NOTIFY_CHANGE_CREATION) {
|
||||
result = talloc_asprintf_append(result, "CREATION|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "CREATION|");
|
||||
}
|
||||
if (filter & FILE_NOTIFY_CHANGE_EA) {
|
||||
result = talloc_asprintf_append(result, "EA|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "EA|");
|
||||
}
|
||||
if (filter & FILE_NOTIFY_CHANGE_SECURITY) {
|
||||
result = talloc_asprintf_append(result, "SECURITY|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "SECURITY|");
|
||||
}
|
||||
if (filter & FILE_NOTIFY_CHANGE_STREAM_NAME) {
|
||||
result = talloc_asprintf_append(result, "STREAM_NAME|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "STREAM_NAME|");
|
||||
}
|
||||
if (filter & FILE_NOTIFY_CHANGE_STREAM_SIZE) {
|
||||
result = talloc_asprintf_append(result, "STREAM_SIZE|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "STREAM_SIZE|");
|
||||
}
|
||||
if (filter & FILE_NOTIFY_CHANGE_STREAM_WRITE) {
|
||||
result = talloc_asprintf_append(result, "STREAM_WRITE|");
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
talloc_asprintf_addbuf(&result, "STREAM_WRITE|");
|
||||
}
|
||||
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (*result == '\0') return result;
|
||||
|
Loading…
Reference in New Issue
Block a user