- if (strlen(backupidstr) > MAXPGPATH) + if (strlcpy(state->name, backupidstr, sizeof(state->name)) >= sizeof(state->name)) ereport(ERROR,
Stylistic nit perhaps, I would keep the strlen check here and just replace the memcpy with strlcpy. Using strlen in the error message check makes the code more readable.
This is not performance-critical code, so I see no problem using strlen, for the sake of readability.