+static char *update_environment_buffer_entry(char *x, int fd) {
+ int length = snprintf(x, 10 + 1, "%d", fd);
+ if (length >= 10 + 1) {
+ /* Integer too big to fit the buffer, skip it. */
+#ifdef WARNING
+ warning("update_environment_buffer_entry(): truncated fd: %d [%d]\n",
+ fd, getpid());
+#endif
+ return x;
+ }
+
+ /* Write comma after number. */
+ x += length;
+ *x++ = ',';
+ /* Make sure the string is always zero terminated. */
+ *x = 0;
+
+ return x;
+}