Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
fflags: emit in string value
Baptiste Daroussin committed 12 days ago
commit c11b97870a4e6372cdede410ce01c58862d17be8
parent 40519f5
1 file changed +34 -6
modified libpkg/pkg_manifest.c
@@ -1198,9 +1198,23 @@ pkg_emit_object(struct pkg *pkg, short flags)
				ucl_object_insert_key(file_attrs,
						      ucl_object_fromstring(perm_str),
						      "perm", 0, false);
-
				ucl_object_insert_key(file_attrs,
-
						      ucl_object_fromint(file->fflags),
-
						      "fflags", 0, false);
+
#ifdef HAVE_FFLAGSTOSTR
+
				if (file->fflags != 0) {
+
					char *fflags_str = fflagstostr(file->fflags);
+
					if (fflags_str != NULL && *fflags_str != '\0') {
+
						ucl_object_insert_key(file_attrs,
+
						    ucl_object_fromstring(fflags_str),
+
						    "fflags", 0, false);
+
					}
+
					free(fflags_str);
+
				}
+
#else
+
				if (file->fflags != 0) {
+
					ucl_object_insert_key(file_attrs,
+
					    ucl_object_fromint(file->fflags),
+
					    "fflags", 0, false);
+
				}
+
#endif
				if (file->symlink_target != NULL) {
					ucl_object_insert_key(file_attrs,
							      ucl_object_fromstring(file->symlink_target),
@@ -1248,9 +1262,23 @@ pkg_emit_object(struct pkg *pkg, short flags)
				ucl_object_insert_key(dir_attrs,
						      ucl_object_fromstring(perm_str),
						      "perm", 0, false);
-
				ucl_object_insert_key(dir_attrs,
-
						      ucl_object_fromint(dir->fflags),
-
						      "fflags", 0, false);
+
#ifdef HAVE_FFLAGSTOSTR
+
				if (dir->fflags != 0) {
+
					char *fflags_str = fflagstostr(dir->fflags);
+
					if (fflags_str != NULL && *fflags_str != '\0') {
+
						ucl_object_insert_key(dir_attrs,
+
						    ucl_object_fromstring(fflags_str),
+
						    "fflags", 0, false);
+
					}
+
					free(fflags_str);
+
				}
+
#else
+
				if (dir->fflags != 0) {
+
					ucl_object_insert_key(dir_attrs,
+
					    ucl_object_fromint(dir->fflags),
+
					    "fflags", 0, false);
+
				}
+
#endif

				urlencode(dir->path, &tmpsbuf);
				if (map == NULL)