mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 14:34:29 +00:00
vfb: use xhostname()
Simplify vfbWriteXWDFileHeader() by using xhostname(). Neither need to care about OS specifics here, nor take care of zero-terminating the hostname string - xhostname() is already doing this. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
df0d09dcb2
commit
4d532adf7d
@@ -44,6 +44,7 @@ from The Open Group.
|
||||
#include "os/cmdline.h"
|
||||
#include "os/ddx_priv.h"
|
||||
#include "os/osdep.h"
|
||||
#include "os/xhostname.h"
|
||||
|
||||
#include "scrnintstr.h"
|
||||
#include "servermd.h"
|
||||
@@ -701,7 +702,6 @@ vfbWriteXWDFileHeader(ScreenPtr pScreen)
|
||||
{
|
||||
vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
|
||||
XWDFileHeader *pXWDHeader = pvfb->pXWDHeader;
|
||||
char hostname[XWD_WINDOW_NAME_LEN];
|
||||
unsigned long swaptest = 1;
|
||||
int i;
|
||||
|
||||
@@ -736,12 +736,10 @@ vfbWriteXWDFileHeader(ScreenPtr pScreen)
|
||||
pXWDHeader->window_bdrwidth = 0;
|
||||
|
||||
/* write xwd "window" name: Xvfb hostname:server.screen */
|
||||
|
||||
if (-1 == gethostname(hostname, sizeof(hostname)))
|
||||
hostname[0] = 0;
|
||||
else
|
||||
hostname[XWD_WINDOW_NAME_LEN - 1] = 0;
|
||||
sprintf((char *) (pXWDHeader + 1), "Xvfb %s:%s.%d", hostname, display,
|
||||
struct xhostname hn;
|
||||
xhostname(&hn);
|
||||
hn.name[XWD_WINDOW_NAME_LEN - 1] = 0;
|
||||
sprintf((char *) (pXWDHeader + 1), "Xvfb %s:%s.%d", hn.name, display,
|
||||
pScreen->myNum);
|
||||
|
||||
/* write colormap pixel slot values */
|
||||
|
||||
Reference in New Issue
Block a user