Skip to contentSkip to conversation

prlimit: return proper type

PATCH Applied Davidlohr Bueso 3 participants 4 messages Dec 8, 2011 – Dec 16, 2011 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 prlimit: return proper type

From: Davidlohr Bueso <[email protected]>

The add_prlim() function's definition currently returns a bogus structure.

---
 sys-utils/prlimit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sys-utils/prlimit.c +1 -1
index ae5453b..c785909 100644
@@ -450,7 +450,7 @@ static int parse_prlim(struct rlimit *lim, char *ops, size_t id)
 	return found;
 }
 
-static struct prlimit *add_prlim(char *ops, struct list_head *lims, size_t id)
+static int add_prlim(char *ops, struct list_head *lims, size_t id)
 {
 	struct prlimit *lim = calloc(1, sizeof(*lim));
 
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 1 line · Davidlohr Bueso

The add_prlim() function's definition currently returns a bogus structure=

.

Quoted 1 line

-static struct prlimit *add_prlim(char *ops, struct list_head *lims, size=

_t id)

Quoted 1 line

+static int add_prlim(char *ops, struct list_head *lims, size_t id)

Why not void and remove that return stmt?
The return code is not used anywhere.

Have a nice day,
Berny=

#2 lore raw

I'd rather have the function return a proper status and not use it than not return anything.

Thanks,
Davidlohr

Quoted 12 lines · Bernhard

sys-utils/prlimit.c static int parse_prlim(struct rlimit *lim, char *ops, size_t id) · line 453

Quoted 4 lines · Davidlohr Bueso

The add_prlim() function's definition currently returns a bogus structure.

sys-utils/prlimit.c +1 -1
-static struct prlimit *add_prlim(char *ops, struct list_head *lims, size_t id)
+static int add_prlim(char *ops, struct list_head *lims, size_t id)

Why not void and remove that return stmt?
The return code is not used anywhere.

Have a nice day,
Berny