[Git][cmucl/cmucl][issue-130-file-author-in-c] Revert previous change and use Carl's suggestion.
Raymond Toy (@rtoy)
gitlab at common-lisp.net
Mon Oct 17 18:36:52 UTC 2022
Raymond Toy pushed to branch issue-130-file-author-in-c at cmucl / cmucl
Commits:
10874b35 by Raymond Toy at 2022-10-17T11:34:00-07:00
Revert previous change and use Carl's suggestion.
- - - - -
1 changed file:
- src/lisp/os-common.c
Changes:
=====================================
src/lisp/os-common.c
=====================================
@@ -730,7 +730,7 @@ os_file_author(const char *path)
{
struct stat sb;
char initial[1024];
- char *buffer, *newbuffer;
+ char *buffer, *obuffer;
size_t size;
struct passwd pwd;
struct passwd *ppwd;
@@ -742,6 +742,7 @@ os_file_author(const char *path)
result = NULL;
buffer = initial;
+ obuffer = NULL;
size = sizeof(initial) / sizeof(initial[0]);
/*
@@ -757,11 +758,10 @@ os_file_author(const char *path)
case ERANGE:
/* Buffer is too small, double its size and try again */
size *= 2;
- if ((newbuffer = realloc((buffer == initial) ? NULL : buffer,
- size)) == NULL) {
+ obuffer = (buffer == initial) ? NULL : buffer;
+ if ((buffer = realloc(obuffer, size)) == NULL) {
goto exit;
}
- buffer = newbuffer;
continue;
default:
/* All other errors */
@@ -769,9 +769,7 @@ os_file_author(const char *path)
}
}
exit:
- if (buffer != initial) {
- free(buffer);
- }
+ free(obuffer);
return result;
}
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/10874b356c10e8eca0f5e4393b89b634c39ee1f9
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/10874b356c10e8eca0f5e4393b89b634c39ee1f9
You're receiving this email because of your account on gitlab.common-lisp.net.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20221017/9dd3d563/attachment-0001.html>
More information about the cmucl-cvs
mailing list