diff options
| author | Usman Akinyemi <usmanakinyemi202@gmail.com> | 2025-02-15 21:20:49 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-02-18 09:05:12 -0800 |
| commit | 0a78d61247922f30ebf2ce09025dcaa7bd7e3583 (patch) | |
| tree | 52572e28b9fbca5fd2281f6fcd2507210bd79c18 /builtin | |
| parent | cdfd081df6fa42e6cd0da1d978d41b836c1f292b (diff) | |
| download | git-0a78d61247922f30ebf2ce09025dcaa7bd7e3583.tar.xz | |
version: refactor get_uname_info()
Some code from "builtin/bugreport.c" uses uname(2) to get system
information.
Let's refactor this code into a new get_uname_info() function, so
that we can reuse it in a following commit.
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/bugreport.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/builtin/bugreport.c b/builtin/bugreport.c index 7c2df035c9..5e13d532a8 100644 --- a/builtin/bugreport.c +++ b/builtin/bugreport.c @@ -12,10 +12,10 @@ #include "diagnose.h" #include "object-file.h" #include "setup.h" +#include "version.h" static void get_system_info(struct strbuf *sys_info) { - struct utsname uname_info; char *shell = NULL; /* get git version from native cmd */ @@ -24,16 +24,7 @@ static void get_system_info(struct strbuf *sys_info) /* system call for other version info */ strbuf_addstr(sys_info, "uname: "); - if (uname(&uname_info)) - strbuf_addf(sys_info, _("uname() failed with error '%s' (%d)\n"), - strerror(errno), - errno); - else - strbuf_addf(sys_info, "%s %s %s %s\n", - uname_info.sysname, - uname_info.release, - uname_info.version, - uname_info.machine); + get_uname_info(sys_info); strbuf_addstr(sys_info, _("compiler info: ")); get_compiler_info(sys_info); |
