mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
Avoid races.
This commit is contained in:
parent
8785ffc980
commit
40d3102bc7
@ -683,6 +683,7 @@ get_mime_handler_mailcap(unsigned char *type, struct terminal *term)
|
|||||||
#if defined(HAVE_SYS_IPC_H) && defined(HAVE_SYS_SEM_H) && defined(HAVE_SYS_SHM_H)
|
#if defined(HAVE_SYS_IPC_H) && defined(HAVE_SYS_SEM_H) && defined(HAVE_SYS_SHM_H)
|
||||||
if (!shared_mem)
|
if (!shared_mem)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
shared_mem[0] = '\0'; /* For unexpected death of slave. */
|
||||||
len = strlen(type) + 1;
|
len = strlen(type) + 1;
|
||||||
data = fmem_alloc(2 + len);
|
data = fmem_alloc(2 + len);
|
||||||
if (!data)
|
if (!data)
|
||||||
@ -693,7 +694,6 @@ get_mime_handler_mailcap(unsigned char *type, struct terminal *term)
|
|||||||
hard_write(term->fdout, data, len + 2);
|
hard_write(term->fdout, data, len + 2);
|
||||||
fmem_free(data);
|
fmem_free(data);
|
||||||
|
|
||||||
shared_mem[0] = '\0'; /* For unexpected death of slave. */
|
|
||||||
sem_wait(master_sem);
|
sem_wait(master_sem);
|
||||||
if (!*shared_mem)
|
if (!*shared_mem)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user