您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ talloc_asprintf函数代码示例

51自学网 2021-06-03 08:39:42
  C++
这篇教程C++ talloc_asprintf函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中talloc_asprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ talloc_asprintf函数的具体用法?C++ talloc_asprintf怎么用?C++ talloc_asprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了talloc_asprintf函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: torture_samba3_posixtimedlock

bool torture_samba3_posixtimedlock(struct torture_context *tctx){	struct smbcli_state *cli;	NTSTATUS status;	bool ret = true;	const char *dirname = "posixlock";	const char *fname = "locked";	const char *fpath;	const char *localdir;	const char *localname;	int fnum = -1;	int fd = -1;	struct flock posix_lock;	union smb_lock io;	struct smb_lock_entry lock_entry;	struct smbcli_request *req;	struct lock_result_state lock_result;	struct tevent_timer *te;	if (!torture_open_connection(&cli, tctx, 0)) {		ret = false;		goto done;	}	smbcli_deltree(cli->tree, dirname);	status = smbcli_mkdir(cli->tree, dirname);	if (!NT_STATUS_IS_OK(status)) {		torture_warning(tctx, "smbcli_mkdir failed: %s/n",				nt_errstr(status));		ret = false;		goto done;	}	if (!(fpath = talloc_asprintf(tctx, "%s//%s", dirname, fname))) {		torture_warning(tctx, "talloc failed/n");		ret = false;		goto done;	}	fnum = smbcli_open(cli->tree, fpath, O_RDWR | O_CREAT, DENY_NONE);	if (fnum == -1) {		torture_warning(tctx, "Could not create file %s: %s/n", fpath,				smbcli_errstr(cli->tree));		ret = false;		goto done;	}	if (!(localdir = torture_setting_string(tctx, "localdir", NULL))) {		torture_warning(tctx, "Need 'localdir' setting/n");		ret = false;		goto done;	}	if (!(localname = talloc_asprintf(tctx, "%s/%s/%s", localdir, dirname,					  fname))) {		torture_warning(tctx, "talloc failed/n");		ret = false;		goto done;	}	/*	 * Lock a byte range from posix	 */	fd = open(localname, O_RDWR);	if (fd == -1) {		torture_warning(tctx, "open(%s) failed: %s/n",				localname, strerror(errno));		goto done;	}	posix_lock.l_type = F_WRLCK;	posix_lock.l_whence = SEEK_SET;	posix_lock.l_start = 0;	posix_lock.l_len = 1;	if (fcntl(fd, F_SETLK, &posix_lock) == -1) {		torture_warning(tctx, "fcntl failed: %s/n", strerror(errno));		ret = false;		goto done;	}	/*	 * Try a cifs brlock without timeout to see if posix locking = yes	 */	io.lockx.in.ulock_cnt = 0;	io.lockx.in.lock_cnt = 1;	lock_entry.count = 1;	lock_entry.offset = 0;	lock_entry.pid = cli->tree->session->pid;	io.lockx.level = RAW_LOCK_LOCKX;	io.lockx.in.mode = LOCKING_ANDX_LARGE_FILES;	io.lockx.in.timeout = 0;	io.lockx.in.locks = &lock_entry;//.........这里部分代码省略.........
开发者ID:AllardJ,项目名称:Tomato,代码行数:101,


示例2: ads_guess_service_principal

static ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,					      char **returned_principal){	ADS_STATUS status = ADS_ERROR(LDAP_NO_MEMORY);	char *princ = NULL;	TALLOC_CTX *frame;	char *server = NULL;	char *realm = NULL;	int rc;	frame = talloc_stackframe();	if (frame == NULL) {		return ADS_ERROR(LDAP_NO_MEMORY);	}	if (ads->server.realm && ads->server.ldap_server) {		server = strlower_talloc(frame, ads->server.ldap_server);		if (server == NULL) {			goto out;		}		realm = strupper_talloc(frame, ads->server.realm);		if (realm == NULL) {			goto out;		}		/*		 * If we got a name which is bigger than a NetBIOS name,		 * but isn't a FQDN, create one.		 */		if (strlen(server) > 15 && strstr(server, ".") == NULL) {			char *dnsdomain;			dnsdomain = strlower_talloc(frame, ads->server.realm);			if (dnsdomain == NULL) {				goto out;			}			server = talloc_asprintf(frame,						 "%s.%s",						 server, dnsdomain);			if (server == NULL) {				goto out;			}		}	} else if (ads->config.realm && ads->config.ldap_server_name) {		server = strlower_talloc(frame, ads->config.ldap_server_name);		if (server == NULL) {			goto out;		}		realm = strupper_talloc(frame, ads->config.realm);		if (realm == NULL) {			goto out;		}		/*		 * If we got a name which is bigger than a NetBIOS name,		 * but isn't a FQDN, create one.		 */		if (strlen(server) > 15 && strstr(server, ".") == NULL) {			char *dnsdomain;			dnsdomain = strlower_talloc(frame, ads->server.realm);			if (dnsdomain == NULL) {				goto out;			}			server = talloc_asprintf(frame,						 "%s.%s",						 server, dnsdomain);			if (server == NULL) {				goto out;			}		}	}	if (server == NULL || realm == NULL) {		goto out;	}	rc = asprintf(&princ, "ldap/%[email
C++ talloc_asprintf_append函数代码示例
C++ talloc_array_length函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。