206
207 return (NULL);
208 }
209
210 void
211 secflags_to_str(secflagset_t flags, char *buf, size_t buflen)
212 {
213 struct flagdesc *fd;
214
215 if (buflen >= 1)
216 buf[0] = '\0';
217
218 if (flags == 0) {
219 (void) strlcpy(buf, "none", buflen);
220 return;
221 }
222
223 for (fd = flagdescs; fd->name != NULL; fd++) {
224 if (secflag_isset(flags, fd->value)) {
225 if (buf[0] != '\0')
226 (void) strlcat(buf, ", ", buflen);
227 (void) strlcat(buf, fd->name, buflen);
228 }
229
230 secflag_clear(&flags, fd->value);
231 }
232
233 if (flags != 0) { /* unknown flags */
234 char hexbuf[11]; /* 0x%08x */
235
236 (void) snprintf(hexbuf, sizeof (hexbuf), "0x%08x", flags);
237 if (buf[0] != '\0')
238 (void) strlcat(buf, ", ", buflen);
239 (void) strlcat(buf, hexbuf, buflen);
240 }
241 }
|
206
207 return (NULL);
208 }
209
210 void
211 secflags_to_str(secflagset_t flags, char *buf, size_t buflen)
212 {
213 struct flagdesc *fd;
214
215 if (buflen >= 1)
216 buf[0] = '\0';
217
218 if (flags == 0) {
219 (void) strlcpy(buf, "none", buflen);
220 return;
221 }
222
223 for (fd = flagdescs; fd->name != NULL; fd++) {
224 if (secflag_isset(flags, fd->value)) {
225 if (buf[0] != '\0')
226 (void) strlcat(buf, ",", buflen);
227 (void) strlcat(buf, fd->name, buflen);
228 }
229
230 secflag_clear(&flags, fd->value);
231 }
232
233 if (flags != 0) { /* unknown flags */
234 char hexbuf[19]; /* 0x%16 PRIx64 */
235
236 (void) snprintf(hexbuf, sizeof (hexbuf), "0x%16" PRIx64, flags);
237 if (buf[0] != '\0')
238 (void) strlcat(buf, ",", buflen);
239 (void) strlcat(buf, hexbuf, buflen);
240 }
241 }
|