void-packages/srcpkgs/accountsservice/patches/musl-fgetspent_r.patch

35 lines
1.4 KiB
Diff

Musl libc does not support fgetspent_r(), so fall back
to using the non-thread-safe fgetspent() function.
--- src/daemon.c 2016-09-06 21:48:50.000000000 +0200
+++ src/daemon.c 2016-11-25 10:41:01.614534302 +0100
@@ -174,7 +174,7 @@
int ret = 0;
shadow_entry_buffers = g_malloc0 (sizeof (*shadow_entry_buffers));
-
+#if defined(__GLIBC__)
ret = fgetspent_r (fp, &shadow_entry_buffers->spbuf, shadow_entry_buffers->buf, sizeof (shadow_entry_buffers->buf), &shadow_entry);
if (ret == 0) {
g_hash_table_insert (shadow_users, g_strdup (shadow_entry->sp_namp), shadow_entry_buffers);
@@ -185,6 +185,19 @@
break;
}
}
+#else
+ /* Musl libc does not support fgetspent_r(), so fall back
+ * to using the non-thread-safe fgetspent() function.
+ */
+ shadow_entry = fgetspent(fp);
+ if (shadow_entry == NULL) {
+ g_free (shadow_entry_buffers);
+
+ if (errno != EINTR) {
+ break;
+ }
+ }
+#endif
} while (shadow_entry != NULL);
fclose (fp);