Message ID | 5304be9808e0346f6f8e2bc76279451dd17d82be.camel@mengyan1223.wang |
---|---|
State | New |
Headers | show |
Series | fixincludes: simplify handling for access() failure [PR21283, PR80047] | expand |
Perfect. On 11/12/21 1:58 PM, Xi Ruoyao wrote: > diff --git a/fixincludes/fixincl.c b/fixincludes/fixincl.c > index 6dba2f6e830..ee57fbf61b4 100644 > --- a/fixincludes/fixincl.c > +++ b/fixincludes/fixincl.c > @@ -1352,11 +1352,10 @@ process (void) > > if (access (pz_curr_file, R_OK) != 0) > { > - int erno = errno; > - fprintf (stderr, "Cannot access %s from %s\n\terror %d (%s)\n", > - pz_curr_file, getcwd ((char *) NULL, MAXPATHLEN), > - erno, xstrerror (erno)); > - return; > + /* Some really strange error happened. */ > + fprintf (stderr, "Cannot access %s: %s\n", pz_curr_file, > + xstrerror (errno)); > + abort(); > } > > pz_curr_data = load_file (pz_curr_file);
On Sat, 2021-11-13 at 08:13 -0800, Bruce Korb wrote: > Perfect. Committed at r12-5234 with minor format fix. > On 11/12/21 1:58 PM, Xi Ruoyao wrote: > > diff --git a/fixincludes/fixincl.c b/fixincludes/fixincl.c > > index 6dba2f6e830..ee57fbf61b4 100644 > > --- a/fixincludes/fixincl.c > > +++ b/fixincludes/fixincl.c > > @@ -1352,11 +1352,10 @@ process (void) > > > > if (access (pz_curr_file, R_OK) != 0) > > { > > - int erno = errno; > > - fprintf (stderr, "Cannot access %s from %s\n\terror %d > > (%s)\n", > > - pz_curr_file, getcwd ((char *) NULL, MAXPATHLEN), > > - erno, xstrerror (erno)); > > - return; > > + /* Some really strange error happened. */ > > + fprintf (stderr, "Cannot access %s: %s\n", pz_curr_file, > > + xstrerror (errno)); > > + abort(); > > } > > > > pz_curr_data = load_file (pz_curr_file);
diff --git a/fixincludes/fixincl.c b/fixincludes/fixincl.c index 6dba2f6e830..ee57fbf61b4 100644 --- a/fixincludes/fixincl.c +++ b/fixincludes/fixincl.c @@ -1352,11 +1352,10 @@ process (void) if (access (pz_curr_file, R_OK) != 0) { - int erno = errno; - fprintf (stderr, "Cannot access %s from %s\n\terror %d (%s)\n", - pz_curr_file, getcwd ((char *) NULL, MAXPATHLEN), - erno, xstrerror (erno)); - return; + /* Some really strange error happened. */ + fprintf (stderr, "Cannot access %s: %s\n", pz_curr_file, + xstrerror (errno)); + abort(); } pz_curr_data = load_file (pz_curr_file);