From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by sourceware.org (Postfix) with ESMTPS id 2D3BE3858404 for ; Thu, 12 Oct 2023 14:57:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2D3BE3858404 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=logitech.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=logitech.com Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-57bb6b1f764so639298eaf.2 for ; Thu, 12 Oct 2023 07:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=logitech.com; s=google; t=1697122647; x=1697727447; darn=sourceware.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=KKdQVisYhJhqVFulZnKMiJ8PX4HUCSQp2CTvdeQdQE4=; b=Hn9d3DneeY2Cali+11bTZH8GOcUZCW65w0HYoQaouELdoT4yrqn66PZywNU3K8yJRT h07luwh3hzwSemnDoR8W1321lXG/Byu6fhilG/b8Qc7LUFRbXkcrmNgaVww4H5hPM0gK GsGSooz23WAekkMV/6s6nrRaa4lHu27kSAng7+/pTZbPFcJPyFf6dvv4FCvJQjkNspDx JQpkTYAOuLmaAHW6ijGcnLThNtsr7/+IU66Q43In/Ovn1aE4+etheOLkd6s7oqUn+J0D dJWqmL+fyhy1SDyyq1tmyrSp51N4wgPjNxh+By+vLRXjcaOTU9xpLiy+8RKL0OQA6mu5 bycQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697122647; x=1697727447; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=KKdQVisYhJhqVFulZnKMiJ8PX4HUCSQp2CTvdeQdQE4=; b=B702BxqHXYbOM6PVt/57nDwrRRRfe5npiG5g7johk84y3cWsVLLBxkg9o1y0fXn0uN WFacTy2dJLh1o0jyQNu7N2gyDNRUMYofGSS15Bv6/qSnq8uQE9bKNHkmWTc1/8RtlrTc MPljTarrx0TBBWZhJWLMy/Tpr2csu6hh9GIpTtv6P347ujx854jK9y1QbNWCYdiZHbS3 Z934bOmb0KoSNeoXiSjzpiZPpljchua7JCvVh9ArH5Kb4uo+6nCC4AspRBX/EOjmcCD2 Vns4vYXVJY1w6ukqdCk575GsZKFW2Be/xH+VmpFOgNBe3ZBnW3iaQ0hl3nrHPa1H4d0n fJag== X-Gm-Message-State: AOJu0Ywnmroi6dN3EP/mD1sp20ts/ZBBlWen4SaU2af97I5Gq7hrKJUa fMEpluVksY8MsNFAGs++/D/TT0r8fzsLMPYnLozf+b1JZEmGgF7O X-Google-Smtp-Source: AGHT+IGts47sJ6VAkUUWVXMlOrT5+shCZza4TK1UFQM+EvMXgSZk98P5EH6OAa4z+RNBmzvB6yCo4+VerNgMPbIG4aI= X-Received: by 2002:a4a:6c5d:0:b0:57b:a92a:ece9 with SMTP id u29-20020a4a6c5d000000b0057ba92aece9mr23656969oof.6.1697122647083; Thu, 12 Oct 2023 07:57:27 -0700 (PDT) MIME-Version: 1.0 From: Nick Stoughton Date: Thu, 12 Oct 2023 07:57:16 -0700 Message-ID: Subject: fmemopen question To: libc-help@sourceware.org Content-Type: multipart/alternative; boundary="000000000000854e2c0607862856" X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000854e2c0607862856 Content-Type: text/plain; charset="UTF-8" If I open a file for writing and immediately close it: fclose(fopen("foo", "w")); the file "foo" will be truncated to zero length if it exists. However, I I do this with a memory buffer, e.g. char arr[] = { 'a','a','a','a','a','a','a','a','a','a', 0}; fclose(fmemopen(arr, 10, "w")); I would expect that arr[0] would have a null byte. But it doesn't. Is this a bug? -- Nick --000000000000854e2c0607862856--