patch: **** malformed patch at line

本文介绍了解决patch应用过程中出现的malformed patch错误的方法。当patch文件被手动修改导致记录行数与实际不匹配时,文章提供了具体的修正步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

patch: malformed patch at line 129
出现这中错误,一般是 patch 生成后被手工修改了,如下的patch:
patch: **** malformed patch at line
数字6,表示记录了6行原始文件,数字13表示记录了13行目标文件
如果你这时手工加了一行:
这是你应用这个补丁,patch 就会提示失败,并输出:
patch: malformed patch at line xxx
应用时,patch 都会检查受影响的行是否与记录在两个 @@ 之间的数值一致,手工加一行后,记录的目标文件行数为14,因此patch会失败。****
patch: **** malformed patch at line

将@@ -104,6 +104,13 @@ 改为@@ -104,6 +104,14 @@ 即可成功打上patch


本文转自 Linux_woniu 51CTO博客,原文链接:http://blog.51cto.com/linuxcgi/2063614


patch -p1 < /home/lhl/ga-sig/sig/device/soc/spreadtrum/patches/third_party/wpa_supplicant/0001_wpa_supplicant_add-sae-support.patch patching file wpa_supplicant-2.9_standard/src/ap/ap_config.h Hunk #1 succeeded at 252 (offset 6 lines). patching file wpa_supplicant-2.9_standard/src/ap/beacon.c Hunk #1 succeeded at 2661 with fuzz 2 (offset 808 lines). patching file wpa_supplicant-2.9_standard/src/ap/drv_callbacks.c Hunk #1 succeeded at 60 with fuzz 1 (offset 5 lines). Hunk #2 succeeded at 558 (offset 181 lines). Hunk #3 succeeded at 899 (offset 198 lines). Hunk #4 succeeded at 962 (offset 203 lines). patching file wpa_supplicant-2.9_standard/src/ap/ieee802_11.c Hunk #2 succeeded at 542 (offset 60 lines). patching file wpa_supplicant-2.9_standard/src/ap/ieee802_11.h Hunk #1 succeeded at 155 (offset 30 lines). patching file wpa_supplicant-2.9_standard/src/common/ieee802_11_defs.h Hunk #1 succeeded at 1434 (offset 61 lines). patching file wpa_supplicant-2.9_standard/src/common/sae.h patching file wpa_supplicant-2.9_standard/src/common/wpa_common.c Hunk #1 succeeded at 1738 (offset 245 lines). patching file wpa_supplicant-2.9_standard/src/common/wpa_common.h Hunk #1 succeeded at 487 with fuzz 2 (offset 27 lines). patching file wpa_supplicant-2.9_standard/src/crypto/tls_openssl.c Hunk #1 succeeded at 2724 (offset 131 lines). patching file wpa_supplicant-2.9_standard/src/drivers/driver.h Hunk #1 succeeded at 4388 (offset 441 lines). Hunk #2 succeeded at 4399 (offset 441 lines). Hunk #3 succeeded at 4712 (offset 453 lines). patching file wpa_supplicant-2.9_standard/src/drivers/driver_nl80211.c Hunk #1 succeeded at 12134 (offset 1170 lines). Hunk #2 succeeded at 14326 (offset 1484 lines). Hunk #3 succeeded at 14368 with fuzz 2 (offset 1489 lines). patching file wpa_supplicant-2.9_standard/src/drivers/driver_nl80211.h Hunk #1 succeeded at 374 with fuzz 2 (offset 41 lines). patching file wpa_supplicant-2.9_standard/src/drivers/driver_nl80211_capa.c Hunk #1 succeeded at 260 (offset -1 lines). Hunk #2 succeeded at 275 (offset -1 lines). Hunk #3 succeeded at 284 (offset -1 lines). patching file wpa_supplicant-2.9_standard/wpa_supplicant/driver_i.h Hunk #1 succeeded at 787 (offset -14 lines). patching file wpa_supplicant-2.9_standard/wpa_supplicant/events.c patch: **** malformed patch at line 603: diff --git a/wpa_supplicant-2.9_standard/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant-2.9_standard/wpa_supplicant/p2p_supplicant.c
07-13
diff --git a/wpa_supplicant-2.9_standard/wpa_supplicant/events.c b/wpa_supplicant-2.9_standard/wpa_supplicant/events.c index a075284..4351d8a 100644 --- a/wpa_supplicant-2.9_standard/wpa_supplicant/events.c +++ b/wpa_supplicant-2.9_standard/wpa_supplicant/events.c @@ -4057,13 +4057,29 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, wpa_s, WLAN_REASON_DEAUTH_LEAVING); return; } -#ifdef CONFIG_MLD_PATCH - if (wpa_drv_get_mlo_info(wpa_s) < 0) { - wpa_dbg(wpa_s, MSG_ERROR, "Failed to get MLO connection info"); - wpa_supplicant_deauthenticate(wpa_s, - WLAN_REASON_DEAUTH_LEAVING); - return; - } + +#ifdef CONFIG_SAE +#ifdef CONFIG_DRIVER_NL80211_SPRD + /* process SAE PMK & PMKID */ + if (wpa_key_mgmt_sae(wpa_s->key_mgmt) && + wpa_s->sme.sae_pmksa_caching == 0) { + const u8 *pmk = wpa_get_vendor_ie(data->assoc_info.resp_ies, + data->assoc_info.resp_ies_len, SPRD_SAE_CNN_RES); + if (!pmk) { + wpa_dbg(wpa_s, MSG_ERROR, "SPRD SAE fatal error: no PMK found"); + wpa_supplicant_deauthenticate( + wpa_s, WLAN_REASON_DEAUTH_LEAVING); + return; + } + wpa_hexdump(MSG_INFO, "SPRD SAE auth results-1:", pmk, 2 + 4 + PMK_LEN + PMKID_LEN); + pmk += 6; /* skip vendor IE header: 1 id + 1 len + 4 OUI */ + wpa_hexdump(MSG_INFO, "SPRD SAE auth results-2:", pmk, PMK_LEN); + wpa_hexdump(MSG_INFO, "SPRD SAE auth results-3:", pmk + PMK_LEN, PMKID_LEN); + wpa_printf(MSG_INFO, "SPRD SAE completed - SET PMK for 4-way handshake"); + /* 32 bytes PMK + 16 bytes PMKID from CP2 SAE auth */ + wpa_sm_set_pmk(wpa_s->wpa, pmk, PMK_LEN, pmk + PMK_LEN, bssid); + } +#endif #endif if (data && wpa_supplicant_event_associnfo(wpa_s, data) < 0) return;
07-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值