mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-05 05:01:36 +00:00
added j magic var
This commit is contained in:
+2
-1
@@ -4186,7 +4186,8 @@ char *uwsgi_str_to_hex(char *src, size_t slen) {
|
||||
char *ptr = dst;
|
||||
size_t i;
|
||||
for (i = 0; i < slen; i++) {
|
||||
memcpy(ptr, uwsgi_hex_table[(int) src[i]], 2);
|
||||
uint8_t pos = (uint8_t) src[i];
|
||||
memcpy(ptr, uwsgi_hex_table[pos], 2);
|
||||
ptr += 2;
|
||||
}
|
||||
return dst;
|
||||
|
||||
@@ -1025,6 +1025,12 @@ void config_magic_table_fill(char *filename, char **magic_table) {
|
||||
magic_table['b'] = uwsgi.binary_path;
|
||||
magic_table['p'] = fullname;
|
||||
|
||||
// compute filename hash
|
||||
uint32_t hash = djb33x_hash(magic_table['p'], strlen(magic_table['p']));
|
||||
char *hex = uwsgi_str_to_hex((char *)&hash, 4);
|
||||
magic_table['j'] = uwsgi_concat2n(hex, 8, "", 0);
|
||||
free(hex);
|
||||
|
||||
struct stat st;
|
||||
if (!lstat(fullname, &st)) {
|
||||
magic_table['i'] = uwsgi_num2str(st.st_ino);
|
||||
@@ -1103,6 +1109,7 @@ reuse:
|
||||
magic_table['N'] = magic_table['n'];
|
||||
magic_table['X'] = magic_table['x'];
|
||||
magic_table['I'] = magic_table['i'];
|
||||
magic_table['J'] = magic_table['j'];
|
||||
uwsgi.magic_table_first_round = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user