Skip to content
Snippets Groups Projects
Commit 5a8e98b0 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

pass to local variable

parent 0a7b5f13
No related branches found
No related tags found
No related merge requests found
/* /*
* 66-intree.c * 66-inservice.c
* *
* Copyright (c) 2018-2019 Eric Vidal <eric@obarun.org> * Copyright (c) 2018-2019 Eric Vidal <eric@obarun.org>
* *
...@@ -50,8 +50,6 @@ unsigned int VERBOSITY = 1 ; ...@@ -50,8 +50,6 @@ unsigned int VERBOSITY = 1 ;
static unsigned int REVERSE = 0 ; static unsigned int REVERSE = 0 ;
unsigned int MAXDEPTH = 1 ; unsigned int MAXDEPTH = 1 ;
static unsigned int GRAPH = 0 ; static unsigned int GRAPH = 0 ;
static uid_t OWNER ;
static char OWNERSTR[UID_FMT] ;
static char const *const *ENVP ; static char const *const *ENVP ;
static unsigned int nlog = 20 ; static unsigned int nlog = 20 ;
static stralloc src = STRALLOC_ZERO ; static stralloc src = STRALLOC_ZERO ;
...@@ -526,6 +524,9 @@ int main(int argc, char const *const *argv, char const *const *envp) ...@@ -526,6 +524,9 @@ int main(int argc, char const *const *argv, char const *const *envp)
size_t pos, newlen ; size_t pos, newlen ;
int what[MAXOPTS] = { 0 } ; int what[MAXOPTS] = { 0 } ;
uid_t owner ;
char ownerstr[UID_FMT] ;
ss_resolve_t res = RESOLVE_ZERO ; ss_resolve_t res = RESOLVE_ZERO ;
stralloc satree = STRALLOC_ZERO ; stralloc satree = STRALLOC_ZERO ;
...@@ -595,9 +596,9 @@ int main(int argc, char const *const *argv, char const *const *envp) ...@@ -595,9 +596,9 @@ int main(int argc, char const *const *argv, char const *const *envp)
what[i] = -1 ; what[i] = -1 ;
} }
OWNER = getuid() ; owner = getuid() ;
size_t ownerlen = uid_fmt(OWNERSTR,OWNER) ; size_t ownerlen = uid_fmt(ownerstr,owner) ;
OWNERSTR[ownerlen] = 0 ; ownerstr[ownerlen] = 0 ;
info_field_align(buf,fields,field_suffix,MAXOPTS) ; info_field_align(buf,fields,field_suffix,MAXOPTS) ;
...@@ -607,7 +608,7 @@ int main(int argc, char const *const *argv, char const *const *envp) ...@@ -607,7 +608,7 @@ int main(int argc, char const *const *argv, char const *const *envp)
STYLE = &graph_utf8; STYLE = &graph_utf8;
} }
if (!set_ownersysdir(&src,OWNER)) strerr_diefu1sys(111, "set owner directory") ; if (!set_ownersysdir(&src,owner)) strerr_diefu1sys(111, "set owner directory") ;
if (!stralloc_cats(&src,SS_SYSTEM) || if (!stralloc_cats(&src,SS_SYSTEM) ||
!stralloc_0(&src)) exitstralloc("main") ; !stralloc_0(&src)) exitstralloc("main") ;
src.len-- ; src.len-- ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment