Fixed musl libc build warnings for Alpine.
This commit is contained in:
parent
082284e34b
commit
b8ac9d16ad
3 changed files with 27 additions and 10 deletions
2
APKBUILD
2
APKBUILD
|
|
@ -25,7 +25,7 @@ package() {
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="
|
sha512sums="
|
||||||
8b55a60e15cb35fa766fb890f09f3dd1d2955f244d64ddce1dff21f0e84c9bf515f87839ae88ca437c144117eaefc15607e8fdf1d4dfe7c83afd8cb050704404 moerx.c
|
f3490711f2fdebe4c9200654b63a90b69ffd4dad0e9cf2fd5040a4cd57371ebb3c012a855aff9d8d2aa0a2c500baf2143b581a980177685f863ca3e4cc763851 moerx.c
|
||||||
e6336e712a9a6071b16cbde83cd6f591c480da68cf5185f0db27f321b26adb075844a958e792da419dcb82a930de6cff28bc64a98e9b0facd9350e382aa95ce1 Makefile
|
e6336e712a9a6071b16cbde83cd6f591c480da68cf5185f0db27f321b26adb075844a958e792da419dcb82a930de6cff28bc64a98e9b0facd9350e382aa95ce1 Makefile
|
||||||
56e641534bc68b48a70d7be8337df8a191c5a2a1bafee12dc6d9ac401d107cb6b8cf8138bcc6d4f74d373689e1bb8f2ac298a87043a95f0383d6163dfc363116 moerx.1
|
56e641534bc68b48a70d7be8337df8a191c5a2a1bafee12dc6d9ac401d107cb6b8cf8138bcc6d4f74d373689e1bb8f2ac298a87043a95f0383d6163dfc363116 moerx.1
|
||||||
63f842b7ee65c7bfd3feceeb27a0199f44f3e741a399ee6f59e5c78cfdde951cce88b6f368abd451d4c2efd76b6cda97be15450743031d590fc22020268fd6af README.md
|
63f842b7ee65c7bfd3feceeb27a0199f44f3e741a399ee6f59e5c78cfdde951cce88b6f368abd451d4c2efd76b6cda97be15450743031d590fc22020268fd6af README.md
|
||||||
|
|
|
||||||
2
PKGBUILD
2
PKGBUILD
|
|
@ -9,7 +9,7 @@ license=('Apache-2.0')
|
||||||
depends=('glibc')
|
depends=('glibc')
|
||||||
source=('moerx.c' 'Makefile' 'moerx.1' 'README.md' 'LICENSE')
|
source=('moerx.c' 'Makefile' 'moerx.1' 'README.md' 'LICENSE')
|
||||||
sha256sums=(
|
sha256sums=(
|
||||||
'58b815779cc50ff0aeb41909d611309d1084b6c335dc35a54e79656e3d45cd51'
|
'abc3273b9f9b5b2f29aa72ac73ff925631457786e1200ae1b7c3f9319e1833d0'
|
||||||
'ad08bd0acd671f1f1716250528c2d4e5acc78a83bf55fcebdf41fa101fbb71d5'
|
'ad08bd0acd671f1f1716250528c2d4e5acc78a83bf55fcebdf41fa101fbb71d5'
|
||||||
'56ef9511287758cd32e3c5cf777d7b9d99c470e1cf6570f1a94dcfd2f649b3e6'
|
'56ef9511287758cd32e3c5cf777d7b9d99c470e1cf6570f1a94dcfd2f649b3e6'
|
||||||
'4a4d3158fb5288b93bcfd0ceec76b6b4d83fdb683e2a2a05afa63a0804ba9311'
|
'4a4d3158fb5288b93bcfd0ceec76b6b4d83fdb683e2a2a05afa63a0804ba9311'
|
||||||
|
|
|
||||||
33
moerx.c
33
moerx.c
|
|
@ -581,9 +581,12 @@ static void em_sgr(Pane *p, int *ps, int n) {
|
||||||
i += 2;
|
i += 2;
|
||||||
} else if (ps[i + 1] == 2 && i + 4 < n) {
|
} else if (ps[i + 1] == 2 && i + 4 < n) {
|
||||||
int r = ps[i + 2], g = ps[i + 3], b = ps[i + 4];
|
int r = ps[i + 2], g = ps[i + 3], b = ps[i + 4];
|
||||||
if (r < 0) r = 0; if (r > 255) r = 255;
|
if (r < 0) r = 0;
|
||||||
if (g < 0) g = 0; if (g > 255) g = 255;
|
if (r > 255) r = 255;
|
||||||
if (b < 0) b = 0; if (b > 255) b = 255;
|
if (g < 0) g = 0;
|
||||||
|
if (g > 255) g = 255;
|
||||||
|
if (b < 0) b = 0;
|
||||||
|
if (b > 255) b = 255;
|
||||||
int32_t col = RGB_FLAG | (r << 16) | (g << 8) | b;
|
int32_t col = RGB_FLAG | (r << 16) | (g << 8) | b;
|
||||||
if (target == 0) p->pen.fg = col;
|
if (target == 0) p->pen.fg = col;
|
||||||
else p->pen.bg = col;
|
else p->pen.bg = col;
|
||||||
|
|
@ -1558,10 +1561,12 @@ static int valid_session_name(const char *s) {
|
||||||
static void make_socket_path(const char *name, char *out, size_t n) {
|
static void make_socket_path(const char *name, char *out, size_t n) {
|
||||||
char dir[PATH_MAX];
|
char dir[PATH_MAX];
|
||||||
socket_dir(dir, sizeof dir);
|
socket_dir(dir, sizeof dir);
|
||||||
snprintf(out, n, "%s/%s.sock", dir, name);
|
/* Select the fallback before formatting, so a long runtime directory
|
||||||
if (strlen(out) >= 100) {
|
cannot truncate the socket path. Session names are limited to 48 bytes. */
|
||||||
snprintf(out, n, "/tmp/moerx-%u/%s.sock", (unsigned)getuid(), name);
|
if (strlen(dir) + strlen(name) + 6 >= 100) {
|
||||||
|
snprintf(dir, sizeof dir, "/tmp/moerx-%u", (unsigned)getuid());
|
||||||
}
|
}
|
||||||
|
snprintf(out, n, "%.99s/%.48s.sock", dir, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void client_message(Client *c, const char *fmt, ...) {
|
static void client_message(Client *c, const char *fmt, ...) {
|
||||||
|
|
@ -3541,7 +3546,13 @@ static void server_start(const char *path, const char *name, int readyfd, int sh
|
||||||
struct sockaddr_un saun;
|
struct sockaddr_un saun;
|
||||||
memset(&saun, 0, sizeof saun);
|
memset(&saun, 0, sizeof saun);
|
||||||
saun.sun_family = AF_UNIX;
|
saun.sun_family = AF_UNIX;
|
||||||
snprintf(saun.sun_path, sizeof saun.sun_path, "%s", path);
|
size_t path_len = strlen(path);
|
||||||
|
if (path_len >= sizeof saun.sun_path) {
|
||||||
|
close(lfd);
|
||||||
|
server_fail(readyfd, "socket path", ENAMETOOLONG);
|
||||||
|
_exit(1);
|
||||||
|
}
|
||||||
|
memcpy(saun.sun_path, path, path_len + 1);
|
||||||
unlink(path);
|
unlink(path);
|
||||||
/* Protect the socket without imposing private file permissions on pane
|
/* Protect the socket without imposing private file permissions on pane
|
||||||
shells and their build output (rsync -a preserves those permissions). */
|
shells and their build output (rsync -a preserves those permissions). */
|
||||||
|
|
@ -3632,7 +3643,13 @@ static int connect_session(const char *path) {
|
||||||
struct sockaddr_un sa;
|
struct sockaddr_un sa;
|
||||||
memset(&sa, 0, sizeof sa);
|
memset(&sa, 0, sizeof sa);
|
||||||
sa.sun_family = AF_UNIX;
|
sa.sun_family = AF_UNIX;
|
||||||
snprintf(sa.sun_path, sizeof sa.sun_path, "%s", path);
|
size_t path_len = strlen(path);
|
||||||
|
if (path_len >= sizeof sa.sun_path) {
|
||||||
|
close(fd);
|
||||||
|
errno = ENAMETOOLONG;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
memcpy(sa.sun_path, path, path_len + 1);
|
||||||
if (connect(fd, (struct sockaddr *)&sa, sizeof sa) < 0) {
|
if (connect(fd, (struct sockaddr *)&sa, sizeof sa) < 0) {
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue