if (!pktin) { fxp_internal_error("did not receive a valid SFTP packet\n"); return NULL; }
char *fxp_realpath(char *path){    struct sftp_packet *pktin, *pktout;    int id;    pktout = sftp_pkt_init(SSH_FXP_REALPATH);    sftp_pkt_adduint32(pktout, 0x123); /* request id */    sftp_pkt_addstring_start(pktout);    sftp_pkt_addstring_str(pktout, path);    sftp_send(pktout);    pktin = sftp_recv();    id = sftp_pkt_getuint32(pktin);    if (id != 0x123) {	fxp_internal_error("request ID mismatch\n");	return NULL;    }    if (pktin->type == SSH_FXP_NAME) {	int count;	char *path;	int len;	count = sftp_pkt_getuint32(pktin);	if (count != 1) {	    fxp_internal_error("REALPATH returned name count != 1\n");	    return NULL;	}	sftp_pkt_getstring(pktin, &path, &len);	if (!path) {	    fxp_internal_error("REALPATH returned malformed FXP_NAME\n");	    return NULL;	}	path = mkstr(path, len);	sftp_pkt_free(pktin);	return path;    } else {	fxp_got_status(pktin);	return NULL;    }}