Add function annotations to warn on unused results
SPDX Migration
This commit is contained in:
parent
0adbca557b
commit
fed9b23c8d
50
libcap-ng-0.8.3-wur.patch
Normal file
50
libcap-ng-0.8.3-wur.patch
Normal file
@ -0,0 +1,50 @@
|
||||
diff -urp libcap-ng-0.8.3.orig/src/cap-ng.h libcap-ng-0.8.3/src/cap-ng.h
|
||||
--- libcap-ng-0.8.3.orig/src/cap-ng.h 2022-03-29 16:21:43.000000000 -0400
|
||||
+++ libcap-ng-0.8.3/src/cap-ng.h 2023-09-04 11:35:55.683458005 -0400
|
||||
@@ -27,11 +27,18 @@
|
||||
#include <linux/capability.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+// The next 2 macros originate in sys/cdefs.h
|
||||
+// gcc-analyzer notation
|
||||
#ifndef __attr_dealloc
|
||||
# define __attr_dealloc(dealloc, argno)
|
||||
# define __attr_dealloc_free
|
||||
#endif
|
||||
|
||||
+// Warn unused result
|
||||
+#ifndef __wur
|
||||
+# define __wur
|
||||
+#endif
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -57,21 +64,21 @@ typedef enum { CAPNG_NO_FLAG=0, CAPNG_D
|
||||
void capng_clear(capng_select_t set);
|
||||
void capng_fill(capng_select_t set);
|
||||
void capng_setpid(int pid);
|
||||
-int capng_get_caps_process(void);
|
||||
+int capng_get_caps_process(void) __wur;
|
||||
int capng_update(capng_act_t action, capng_type_t type,unsigned int capability);
|
||||
int capng_updatev(capng_act_t action, capng_type_t type,
|
||||
unsigned int capability, ...);
|
||||
|
||||
// These functions apply the capabilities previously setup to a process
|
||||
-int capng_apply(capng_select_t set);
|
||||
-int capng_lock(void);
|
||||
-int capng_change_id(int uid, int gid, capng_flags_t flag);
|
||||
+int capng_apply(capng_select_t set) __wur;
|
||||
+int capng_lock(void) __wur;
|
||||
+int capng_change_id(int uid, int gid, capng_flags_t flag) __wur;
|
||||
|
||||
// These functions are used for file based capabilities
|
||||
int capng_get_rootid(void);
|
||||
int capng_set_rootid(int rootid);
|
||||
-int capng_get_caps_fd(int fd);
|
||||
-int capng_apply_caps_fd(int fd);
|
||||
+int capng_get_caps_fd(int fd) __wur;
|
||||
+int capng_apply_caps_fd(int fd) __wur;
|
||||
|
||||
// These functions check capability bits
|
||||
capng_results_t capng_have_capabilities(capng_select_t set);
|
||||
Loading…
Reference in New Issue
Block a user