Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: allocating a new file descriptor



On Apr 15, 11:27am, Peter Stephenson wrote:
}
} > I also noticed several problems when fidling with fds used
} > internally by zsh (zsocket -d10 or -d11 ended up in a core
} > dump).
} 
} Yes, it doesn't check for existing use of the fd by the shell.
} 
} The same problem exists with the new syntax when closing fd's; I've made
} it check for special fd's, which are those from 10 upwards marked as for
} internal use.  This covers 10, but not 11; I'm not sure what opened
} that, but I think it's some library rather than the shell itself.
} If we can track it down it could be marked as in internal use, too.
} 
} (Maybe it's about time we introduced zwarn and friends to stdarg.h...)

Also maybe it's time we introduced an API in the main part of zsh for
opening and closing files, so that we can stop doing things like this ...

} -unsigned char *fdtable;
} +mod_export unsigned char *fdtable;

[...]

} Index: Src/Modules/socket.c
} ===================================================================
} +	if (targetfd <= max_zsh_fd && fdtable[targetfd] != FDT_UNUSED) {

... and instead encapsulate those sorts of tests in the API functions.
The number of exported globals is starting to bother me; it feels as if
every second patch that's gone by in the past few months has exported
another previously-hidden global symbol.



Messages sorted by: Reverse Date, Date, Thread, Author